Hi Scott, hi list,

Scott Stanton wrote:
> I'm not familiar with Perl's threading model.  Is it possible the END
> block is being called for each thread?  I can see how that might cause
> segfaults if a memory mapped library is moved from its original location
> while still in use.  Some platforms don't handle that very well.
> 
> If that's the case, is there a way to ensure the library cleanup is only
> performed in the main thread after all other threads are joined?

I spent some considerable time on fixing this issue and so far, failed
to do so.

Here's what I found:
a) It's indeed a case where the END block is potentially run for each
thread.
b) There is no way to determine from within the END block whether or not
it's the last running thread.
c) I reported this as a bug in threads to Jerry Hedden. The discussion
is here: http://rt.cpan.org//Ticket/Display.html?id=35836
d) This problem can not be fixed from threads.pm. It doesn't seem
fixable without user intervention from the PAR.pm side of things either.

It doesn't seem like there's any way to fix this. Personally, I'd rather
see some stale cache directories even under CLEAN mode than crashes or
funny lock-ups for all programs using threads. But that's just me. What
does everybody else think?

At the very least, we need to document this well.

Cheers,
Steffen

Reply via email to