Re: Threads Error
Another thing that will help prevent problems, are u locking all ur shared variables before accessing them? {lock $var; pop @array;} etc. At 01:20 AM 8/19/2006 -0400, Chris O wrote: Thanks for the insight. I'm looking into the queing mod now. In the mean time, I found that using an array instead of a hash works flawlessly (so far) but slowed the script about 50%. -- REMEMBER THE WORLD TRADE CENTER ---= WTC 911 =-- ...ne cede malis 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Threads Error
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 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs