Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Buggy CPAN Module (Statistics::R)

by PodMaster (Abbot)
on Mar 03, 2006 at 13:20 UTC ( #534221=note: print w/ replies, xml ) Need Help??


in reply to Buggy CPAN Module (Statistics::R)

I have done some debugging and for me its the send method that hangs ( Statistics::R::Bridge::pipe), in particular this loop

my ($x,$xx) ; while( (!$has_quit || $this->{STOPING} == 1) && -e $file && $this- +>is_started( !$this->{STOPING} ) ) { ++$x ; ##print "sleep $file\n" ; select(undef,undef,undef,$delay) ; if ( $x == 20 ) { my (undef , $data) = $this->read_processR ; if ( $data =~ /\s$n\s+\.\.\.\s+\// ) { last ;} $x = 0 ; ++$xx ; $delay = 0.5 ; } if ( $xx > 5 ) { $status = undef ;} ## xx > 5 = x > 50 }
Its because $n/$data don't match ($n ends up being 1, but $data contains a high number, the last number written to process.log).

$n/$data are populated by read_processR, which reads process.log, which is written to by rterm.exe, as per instructions in start.r (PERLOUTPUTFILE), which is written from sub Statistics::R::Bridge::pipe::save_file_startR.

What happens is that at the beginning of send, where $n is set, read_processR reads data ending with "/", so $n defaults to 1.

mokleva was right, it is some kind of race condition. Whether its rterm that misbehaves, or start.r or Statistics::R that make an assumption ... I don't know. Thats as far as I'm willing to go, but it should be enough information for someone familiar with rterm/statistics-r to fix it.

BTW, my enviroment is perl v5.8.4 ActivePerl Build 810, R 2.2.1, WinXP Home.

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.


Comment on Re: Buggy CPAN Module (Statistics::R)
Download Code
Re^2: Buggy CPAN Module (Statistics::R)
by maybeD (Sexton) on Mar 10, 2006 at 16:48 UTC
    OK, its a real clumsy fudge but it seems to stop the hanging. With this modification in place, my Perl/R script misses some tests out (probably the ones it would have hung on)--but with a properly designed Perl script you can catch which ones it missed and have another go at the end.
    (The script I am currently working on with this is a DBI script, uses a MySQL database ENUM column to record whether all of the required tests have been carried out).

    In pipe.pm, I changed
    if ( $x == 20 ) { my (undef , $data) = $this->read_processR ; if ( $data =~ /\s$n\s+\.\.\.\s+\// ) { last ;} $x = 0 ;
    to
    if ( $x == 20 ) { my (undef , $data) = $this->read_processR ; last; $x = 0 ;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://534221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2014-07-12 15:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (240 votes), past polls