develooper Front page | perl.ithreads | Postings from March 2013

Issues with process forking when 'multithreaded'.

Thread Next
From:
Sander Smeenk
Date:
March 4, 2013 14:25
Subject:
Issues with process forking when 'multithreaded'.
Message ID:
20130304142534.GA7223@dot.freshdot.net
Hi,

I'm new on this list, not sure if this is the right place for this,
please redirect me if this is not on topic here. ;)

I am seeing issues with open3()/waitpid() calls when running the same
code as multiple threads - this does not happen with a single thread
running the code - i'm not sure why this happens, but i can reproduce it
so there must be something wrong somewhere. ;)

What am i seeing:

1) waitpid() sometimes returns the $PID for the child process (as if
   it was reaped) while the child process is still running.

2) waitpid() sometimes returns -1 instead of the correct values for the
   exit state of a child process while the child process ran perfectly
   fine. 

Again, all this only happens when running multiple 'threads'.
Refer to https://8n1.org/raw/8750/71a3 for a codesnipet from the
subroutine which runs as a thread which in turn spawns rsync.

Besides these waitpid() issues, the threaded code seems to run just fine
and no other abnormalities are found.

This is Perl 5.14.2 with ithreads on Ubuntu GNU/Linux, AMD64.
Perhaps this all sounds familiar to any of you? 

Please let me know if more input or code is required!

With regards,
-Sander.
-- 
| 1 1 was a racehorse, 2 2 was 1 2, 1 1 1 1 race 1 day, 2 2 1 1 2
| 4096R/20CC6CD2 - 6D40 1A20 B9AA 87D4 84C7  FBD6 F3A9 9442 20CC 6CD2

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About