#315 Perl Crashes wile running thread programs in EPIC

v0.5.x
open
nobody
Core (65)
9
2006-10-06
2006-10-06
Sanjit Rath
No

Hi,

When I run the following code, Perl crashes in EPIC,
but the same runs fine when run from comand prompt.

Code:
-----------------

use threads;
use threads::shared;
use Thread::Queue;

my $q = Thread::Queue->new();
my $stop : shared = 0;
sub run_logger
{
while($stop == 0 || $q->pending() > 0)
{
print $q->dequeue()," .. printed \n";
}
}

my $tid = threads->create( \&run_logger, "" );
my @val = qw|some bad things are about to happen|;

foreach(@val)
{
$q->enqueue($_);
}
$stop = 1;
$q->enqueue(0);
$tid->join();

-------------
I presume the crash is due to thread spun from perl.
Please look into this error.

Discussion

  • Sanjit Rath
    Sanjit Rath
    2006-10-06

    • priority: 5 --> 9
     
  • Sanjit Rath
    Sanjit Rath
    2006-10-06

    • assigned_to: nobody --> jploski
     
  • Jan Ploski
    Jan Ploski
    2006-10-06

    • assigned_to: jploski --> nobody
     
  • Jan Ploski
    Jan Ploski
    2006-10-06

    Logged In: YES
    user_id=86907

    It runs fine under Linux - no crashes.

     
  • Sanjit Rath
    Sanjit Rath
    2006-10-21

    Logged In: YES
    user_id=991922

    I am getting this crash on Windows.

    I am running latest perl 5.8.8, EPIC 0.5.16

     
  • Logged In: NO

    On linux eclipse 3.2.2, EPIC 0.6.17 and Perl 5.8.8 (i686), when debugger steps into a fork call, Main Thread under Perl Debugger in Debug tab says 'running' and eclipse doesn't hang but I can't step anymore.

    For example:
    ...
    unless($nodaemon){
    setsid();
    chdir('/');
    open(STDIN, "/dev/null");
    open(STDOUT, ">/dev/null");
    open(STDERR, ">&STDOUT");
    > fork() && exit 0;
    debug("Daemonized");
    }
    ...

    Or normal usage of fork:

    ...
    > if($child = fork()){
    debug("Processor forked");
    close(COM_CONV);
    processor($in, $out, $crop);
    } else {
    debug("Receiver forked");
    close(CONV);
    receiver();
    }
    ...