Re: Creating a thread pool within a callback cause segfault

[email protected] (Elizabeth Mattijsen) Fri, 23 Jan 2004 22:41:38 +0100
Newsgroups perl.loop
Message-ID <p05111b00bc374369492f@[192.168.56.3]>
At 14:16 -0500 1/23/04, Gensky Regnus wrote:
>I am having problems mixing the Thread::Pool and Event modules. I 
>can access the a pool created outside of a callback, but can't 
>create a pool within the callback. You can see it by running the 
>program below with and without the argument 'out'.
>
>Please help,

Whoa.   Event _and_ threads...  ;-)

FWIW, with 5.8.3-threaded under valgrind this is the result:

==11978== Invalid read of size 4
==11978==    at 0x8066888: S_my_exit_jump (in 
/usr/local/bin/perl5.8.3-threaded)
==11978==    by 0x80667DF: Perl_my_failure_exit (in 
/usr/local/bin/perl5.8.3-threaded)
==11978==    by 0x80A78C6: Perl_vcroak (in /usr/local/bin/perl5.8.3-threaded)
==11978==    by 0x80A7A6E: Perl_croak (in /usr/local/bin/perl5.8.3-threaded)
==11978==    Address 0x8 is not stack'd, malloc'd or free'd

Seems to me something is breaking while Perl is croaking...


I would welcome any insights... I don't have any tuits to pursue that 
kind of problem with Thread::Pool.

One comment on the code, though.  Why don't you start the pool of 
threads always?

I checked whether this might be related to the on-demand loading of 
subs of Thread::Pool.  Forcing loading of all subroutines at compile 
time (by specifying the environment variable LOAD_NOW) gives 
identical results, so I think we can rule out that as a problem.


Finallly, I wasn't able to get a clean make test of Event.pm with Mac 
OS X.  Is that a known problem?


Liz