segmentation fault / threads

S

Stuart Kendrick

has anyone developed any tricks for spawning lots of threads?

i'm using perl 5.8.5, making use of threads ... i'd like to spawn
several hundred at a time (i've written them to go off and perform
tasks which take a long time ... like perform nessus scans of every
active IP address on a subnet ... )

more often than not, the master thread crumps with a Segmentation
Fault, after spawning ... a few dozen. rather unpredictable, actually
-- sometimes, the whole routine succeeds, spawning several hundred
threads and running them just fine. sometimes, it crumps after
spawning a few ... sometimes after spawning a few dozen ... i don't
see a rhythym yet to the behavior.

i've found that inserting a delay ("sleep 10;" for example) between
spawning events generally increases the number of threads i can launch
before the Segementation Fault occurs. has anyone developed any other
tricks? i realize that threading is new in Perl ... but i find it so
useful, that i'm using it already, despite this wart, in a variety of
applications.

#!/usr/bin/perl
use strict;
use warnings;
use threads;
use threads::shared;
use Thread::Running qw(running);
[...]

--sk

stuart kendrick
fhcrc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top