Skip Menu |

This queue is for tickets about the File-ReadBackwards CPAN distribution.

Report information
The Basics
Id: 68579
Status: open
Priority: 0/
Queue: File-ReadBackwards

People
Owner: Nobody in particular
Requestors: rmb32 [...] cornell.edu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.04
Fixed in: 1.04



Subject: horrible non-killable test process when not enough disk space
rob@nightshade ~$ cpanm --look File::ReadBackwards --> Working on File::ReadBackwards Fetching http://search.cpan.org/CPAN/authors/id/U/UR/URI/File- ReadBackwards-1.04.tar.gz ... OK Entering /home/rob/.cpanm/work/1306875756.2886/File-ReadBackwards-1.04 with /bin/bash rob@nightshade File-ReadBackwards-1.04$ df Filesystem Size Used Avail Use% Mounted on /dev/sda1 71G 66G 903M 99% / none 1.5G 320K 1.5G 1% /dev none 1.5G 2.1M 1.5G 1% /dev/shm none 1.5G 224K 1.5G 1% /var/run none 1.5G 0 1.5G 0% /var/lock /home/rob/.Private 71G 66G 903M 99% /home/rob rob@nightshade File-ReadBackwards-1.04$ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for File::ReadBackwards rob@nightshade File-ReadBackwards-1.04$ make test cp ReadBackwards.pm blib/lib/File/ReadBackwards.pm PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/bw.t .......... ok t/large_file.t .. and hangs. Looking at the processes: rob@nightshade ~$ ps aux | grep perl rob 2886 0.0 0.3 15144 11548 pts/0 S 14:02 0:00 /usr/bin/perl /home/rob/cpan-lib/bin/cpanm --look File::ReadBackwards rob 2969 0.0 0.0 1900 512 pts/0 S+ 14:02 0:00 /bin/sh -c PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t rob 2970 0.0 0.1 9448 5764 pts/0 S+ 14:02 0:00 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/bw.t t/large_file.t rob 2974 0.0 0.1 6876 3316 pts/0 S+ 14:02 0:00 /usr/bin/perl -w t/large_file.t rob 2975 92.1 0.0 5664 1440 pts/0 R+ 14:02 3:50 /usr/bin/perl -e open(BIG, ">bw.data");?seek(BIG, 5_000_000_000, 0);? print BIG "3rd from last line?2nd from last?last line?" ;?exit 0;? In there, it's the "open(BIG" one-liner that's doing it. And it's using 100% CPU. My lap is getting hot. Try to kill -9 it. Over and over. Does not die. Only way to kill it that I've found is to reboot. No fun!
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Tue, 31 May 2011 17:22:34 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
i have heard about the BIG test problem. the large_file.t test was copied from the perl core tests and modified to use ReadFileBackwards. it doesn't create a 5GB file but just seeks out there and should create a file which looks that large. what OS are you one? there is a list of them which skip this test and it currently is set to this: qw( MSWin32 NetWare VMS unicos ) ; i can add more entries to that list to skip if the os doesn't support this test. the newest perl has redone the test and it is called op/lfs.t. it does a real check on whether sparse files are supported and not just a check on OS names. i will steal that part and hopefully it will fix this issue. uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Tue, 31 May 2011 14:40:03 -0700
To: bug-File-ReadBackwards [...] rt.cpan.org
From: Robert Buels <rmb32 [...] cornell.edu>
On 05/31/2011 02:22 PM, Uri Guttman via RT wrote: Show quoted text
> i have heard about the BIG test problem. the large_file.t test was > copied from the perl core tests and modified to use > ReadFileBackwards. it doesn't create a 5GB file but just seeks out there > and should create a file which looks that large. what OS are you one? > there is a list of them which skip this test and it currently is set > to this:
This is Ubuntu 10.04, not exactly anything exotic. The only possibly-exotic thing is that my home dir (and thus ~/.cpanm) is on an ecryptfs volume, which might be getting pissed off about the seek that calls for more space than it has?
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Tue, 31 May 2011 17:47:21 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
Show quoted text
>>>>> "RBvR" == Robert Buels via RT <bug-File-ReadBackwards@rt.cpan.org> writes:
Show quoted text
RBvR> Queue: File-ReadBackwards RBvR> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=68579 >
Show quoted text
RBvR> On 05/31/2011 02:22 PM, Uri Guttman via RT wrote:
Show quoted text
>> i have heard about the BIG test problem. the large_file.t test was >> copied from the perl core tests and modified to use >> ReadFileBackwards. it doesn't create a 5GB file but just seeks out there >> and should create a file which looks that large. what OS are you one? >> there is a list of them which skip this test and it currently is set >> to this:
Show quoted text
RBvR> This is Ubuntu 10.04, not exactly anything exotic. The only RBvR> possibly-exotic thing is that my home dir (and thus ~/.cpanm) is RBvR> on an ecryptfs volume, which might be getting pissed off about RBvR> the seek that calls for more space than it has?
that is likely the culprit. i run ubuntu as well but not encryptfs. try building/installing it by hand in a regular fs if you have one mounted. it is the usual untar, perl Makefile.PL and make install. note that it isn't a seek for more then it has but more likely the fs doesn't support sparse files. try running that core test (t/ops/lfs.t) by hand on that fs and see what it does. since you are using a packaged perl it never ran the core tests. if there is nothing you can do, i will steal the better sparse checking code and patch my test with it. then it should skip the test on your fs. uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Tue, 31 May 2011 15:40:00 -0700
To: bug-File-ReadBackwards [...] rt.cpan.org
From: Robert Buels <rmb32 [...] cornell.edu>
On 05/31/2011 02:47 PM, Uri Guttman via RT wrote: Show quoted text
> mounted. it is the usual untar, perl Makefile.PL and make install. note > that it isn't a seek for more then it has but more likely the fs doesn't
Yep, running it on the regular ext4 FS works OK, even with only 200MB free. Show quoted text
> support sparse files. try running that core test (t/ops/lfs.t) by hand > on that fs and see what it does. since you are using a packaged perl it > never ran the core tests. if there is nothing you can do, i will steal > the better sparse checking code and patch my test with it. then it > should skip the test on your fs.
Yep, the t/op/lfs.t in the perl 5.14.0 release skips on the ecryptfs volume: rob@nightshade perl-5.14.0$ ./perl t/op/lfs.t # checking whether we have sparse files... # s1 = 20 3052238 33188 1 1000 1000 0 1000003 1306881462 1306881462 1306881462 4096 1976 # s2 = 20 3052324 33188 1 1000 1000 0 2000003 1306881462 1306881462 1306881462 4096 3928 1..0 # Skip no sparse files? also, it runs when I move the compiled dist to /tmp. So yep, sounds reasonable to swipe that sparse-checking code.
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Tue, 31 May 2011 19:57:35 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
Show quoted text
>>>>> "RBvR" == Robert Buels via RT <bug-File-ReadBackwards@rt.cpan.org> writes:
Show quoted text
RBvR> Queue: File-ReadBackwards RBvR> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=68579 >
Show quoted text
RBvR> On 05/31/2011 02:47 PM, Uri Guttman via RT wrote:
Show quoted text
>> mounted. it is the usual untar, perl Makefile.PL and make install. note >> that it isn't a seek for more then it has but more likely the fs doesn't
Show quoted text
RBvR> Yep, running it on the regular ext4 FS works OK, even with only 200MB free.
Show quoted text
>> support sparse files. try running that core test (t/ops/lfs.t) by hand >> on that fs and see what it does. since you are using a packaged perl it >> never ran the core tests. if there is nothing you can do, i will steal >> the better sparse checking code and patch my test with it. then it >> should skip the test on your fs.
Show quoted text
RBvR> Yep, the t/op/lfs.t in the perl 5.14.0 release skips on the ecryptfs volume:
Show quoted text
RBvR> rob@nightshade perl-5.14.0$ ./perl t/op/lfs.t RBvR> # checking whether we have sparse files... RBvR> # s1 = 20 3052238 33188 1 1000 1000 0 1000003 1306881462 1306881462 RBvR> 1306881462 4096 1976 RBvR> # s2 = 20 3052324 33188 1 1000 1000 0 2000003 1306881462 1306881462 RBvR> 1306881462 4096 3928 RBvR> 1..0 # Skip no sparse files?
Show quoted text
RBvR> also, it runs when I move the compiled dist to /tmp. So yep, sounds RBvR> reasonable to swipe that sparse-checking code.
ok, that's the answer. i bet they changed the code from OS checking to real sparse checking with fs's came out that didn't do sparse. so it isn't my fault about the module! :) i don't when i will get to this and i am busy with other stuff. maybe later this week is possible. if you want to go ahead and do this it and send me a rewrite, i would appreciate it and then i can just release the new version. thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Wed, 01 Jun 2011 14:30:53 -0700
To: bug-File-ReadBackwards [...] rt.cpan.org
From: Robert Buels <rmb32 [...] cornell.edu>
On 05/31/2011 04:58 PM, Uri Guttman via RT wrote: Show quoted text
> i don't when i will get to this and i am busy with other stuff. maybe > later this week is possible. if you want to go ahead and do this it and > send me a rewrite, i would appreciate it and then i can just release the > new version.
Here's a rewrite, with the sparse-files-detection code lifted from t/op/lfs.t. Look OK? ----------------------------------- #!/usr/local/bin/perl -ws use strict ; use Carp ; use Config ; use Fcntl qw( :seek ) ; use File::Temp qw( tempfile ); use Test::More ; use File::ReadBackwards ; # NOTE: much of this code was taken from the core perl test script # ops/lfs.t. it was modified to test File::ReadBackwards and large files my $test_file = 'bw.data' ; my @test_lines = ( "3rd from last line\n", "2nd from last\n", "last line\n", ) ; my $test_text = join '', @test_lines ; sub skip_all_tests { my( $skip_text ) = @_ ; # unlink $test_file ; plan skip_all => $skip_text ; } if( $Config{lseeksize} < 8 ) { skip_all_tests( "no 64-bit file offsets\n" ) ; } unless( $Config{uselargefiles} ) { skip_all_tests( "no large file support\n" ) ; } unless ( have_sparse_files() ) { skip_all_tests( "no sparse file support\n" ) ; } # run the long seek code below in a subprocess in case it exits with a # signal my $rc = system $^X, '-e', <<"EOF"; open(BIG, ">$test_file"); seek(BIG, 5_000_000_000, 0); print BIG "$test_text" ; exit 0; EOF if( $rc ) { my $error = 'signal ' . ($rc & 0x7f) ; skip_all_tests( "seeking past 2GB failed: $error" ) ; } open(BIG, ">$test_file"); unless( seek(BIG, 5_000_000_000, 0) ) { skip_all_tests( "seeking past 2GB failed: $!" ) ; } # Either the print or (more likely, thanks to buffering) the close will # fail if there are are filesize limitations (process or fs). my $print = print BIG $test_text ; my $close = close BIG; unless ($print && $close) { print "# print failed: $!\n" unless $print; print "# close failed: $!\n" unless $close; if( $! =~/too large/i ) { skip_all_tests( 'writing past 2GB failed: process limits?' ) ; } if( $! =~ /quota/i ) { skip_all_tests( 'filesystem quota limits?' ) ; } skip_all_tests( "large file error: $!" ) ; } plan tests => 2 ; my $bw = File::ReadBackwards->new( $test_file ) or die "can't open $test_file: $!" ; my $line = $bw->readline() ; is( $line, $test_lines[-1], 'last line' ) ; $line = $bw->readline() ; is( $line, $test_lines[-2], 'next to last line' ) ; unlink $test_file ; exit ; ######## subroutines # this is lifted wholesale from t/op/lfs.t in perl. Also, Uri is the # wind beneath my wings. sub have_sparse_files { # don't even try for spare files on some OSs return 0 if { map { $_ => 1 } qw( MSWin32 NetWare VMS unicos ) }->{ $^O }; # take that, readability. my (undef,$big0) = tempfile(); my (undef,$big1) = tempfile(); my (undef,$big2) = tempfile(); # We'll start off by creating a one megabyte file which has # only three "true" bytes. If we have sparseness, we should # consume less blocks than one megabyte (assuming nobody has # one megabyte blocks...) open(BIG, ">$big1") or die "open $big1 failed: $!"; binmode(BIG) or die "binmode $big1 failed: $!"; seek(BIG, 1_000_000, SEEK_SET) or die "seek $big1 failed: $!"; print BIG "big" or die "print $big1 failed: $!"; close(BIG) or die "close $big1 failed: $!"; my @s1 = stat($big1); diag "s1 = @s1"; open(BIG, ">$big2") or die "open $big2 failed: $!"; binmode(BIG) or die "binmode $big2 failed: $!"; seek(BIG, 2_000_000, SEEK_SET) or die "seek $big2 failed: $!"; print BIG "big" or die "print $big2 failed: $!"; close(BIG) or die "close $big2 failed: $!"; my @s2 = stat($big2); diag "s2 = @s2"; unless ( $s1[7] == 1_000_003 && $s2[7] == 2_000_003 && $s1[11] == $s2[11] && $s1[12] == $s2[12] && $s1[12] > 0 ) { diag 'no sparse files. sad face.'; return 0; } diag 'we seem to have sparse files...'; }
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Wed, 01 Jun 2011 21:52:10 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
i will check this in the next day or two. did it work on your encrypted fs? and am i really the wind beneath your wings? who will ever read that but me?! :) thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Thu, 02 Jun 2011 09:45:54 -0700
To: bug-File-ReadBackwards [...] rt.cpan.org
From: Robert Buels <rmb32 [...] cornell.edu>
On 06/01/2011 06:52 PM, Uri Guttman via RT wrote: Show quoted text
> i will check this in the next day or two. did it work on your encrypted > fs?
Yep, test skips on my encrypted fs, and runs on my regular fs, as desired. R
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Thu, 02 Jun 2011 12:51:15 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
Show quoted text
>>>>> "RBvR" == Robert Buels via RT <bug-File-ReadBackwards@rt.cpan.org> writes:
Show quoted text
RBvR> Queue: File-ReadBackwards RBvR> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=68579 >
Show quoted text
RBvR> On 06/01/2011 06:52 PM, Uri Guttman via RT wrote:
Show quoted text
>> i will check this in the next day or two. did it work on your encrypted >> fs?
Show quoted text
RBvR> Yep, test skips on my encrypted fs, and runs on my regular fs, RBvR> as desired.
great. as i said, i am somewhat jammed these days. i will try to get that in and uploaded to cpan as soon as i can. possibly this weekend as it looks clearer. thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #68579] horrible non-killable test process when not enough disk space
Date: Sat, 04 Jun 2011 02:37:36 -0400
To: bug-File-ReadBackwards [...] rt.cpan.org
From: "Uri Guttman" <uri [...] StemSystems.com>
hi robert, i have uploaded the new backwards to http://sysarch.com/File-ReadBackwards-1.05.tar.gz i made one minor change in your test, i have the have_sparse_files sub return 1 at the end. it was saying it had sparse files but it didn't run the planned tests since the boolean test of that call failed. also i commented out the diag calls. if this works for you let me know. thanx for your help here. you are acked in the Changes file. also i plan to post on blogs.perl.org about this. note that i haven't touched this module in 6(!!) years until the sparse file issue came up. thanx, uri -- Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------