At 03:10 PM 8/18/2006 -0400, Chris O wrote:
>huge amount of internet content (similar to a search engine). I'm using a
>hash to store and limit concurrent threads to reasonable number; as well as
>sharing hashes between threads (threads::shared); At seemingly random
>intervals the script crashes with an error like "Free to wrong pool 223f98
>not 1d3d210 at D:/Perl/lib/XSLoader.pm line -1.". Anyone have an idea what
That sounds like a classic thread collision. Something not 100% thread safe
stepping on another thread's toes. I never fully solved the thread death
problem but I did come up with a way to minimize and mitigate it. What I
did was to setup a fixed number of worker threads and dispatch work to them
with a message queue from the main thread. That way u don't have to worry
about too many threads for ur hardware. We have a dual Sparc Sunfire server
with 2GB memory and it can run my script with 100 worker threads. :)
perlthrtut is a good read. U can handle thread death by installing a
$SIG{__DIE__} handler.
$queue = new Thread::Queue;
for (1 .. $numthreads) {
threads->create("workfunction");
}
$queue->enqueue(@hoststocheck);
sub workfunction {
$host = $queue->dequeue;
do_something;
}
--
REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=--
"...ne cede malis"
00000100
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs