Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Fork and creating a thread exits the process

by bliako (Prior)
on Jul 31, 2020 at 11:54 UTC ( #11120125=note: print w/replies, xml ) Need Help??

in reply to Fork and creating a thread exits the process

is sleep 300; honoured?

Replies are listed 'Best First'.
Re^2: Fork and creating a thread exits the process
by fluks (Novice) on Jul 31, 2020 at 12:06 UTC

    No, I tried adding say 1 after fork() and threads->create() and it didn't print it.

    But now with Strawberry 32bit version it seems to work, this is bizarre. All I did differently is I installed WWW::Mechanize, which I use, with cpan. And it came with Strawberry built-in. At least perl -MWWW::Mechanize "print 1" printed 1. I don't understand at all what's happening. Things don't seem to work consistently at all.

      So you say that it does/did not fork() at all? Have you investigated with a simple test script to see if forks happen, how many and under what conditions with what system messages? Can the OS limit the number of forks? Note that Windows does not have a native fork() and so Perl emulates that somehow. See perlfork for the caveats and warnings. (I am exclusively working with Linux so I can't help with anything else)

        Yes, it didn't fork at all. I tried a test script and both, the fork and threads worked. In my program, it was the first fork that failed. I couldn't even print the return value and it doesn't print any error messages on exit.

        I tested now with Strawberry 64bit and I wasn't able to get it work. But I tried again starting with a fresh 32bit version at that still does work.

        Yes, I read about perlfork.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11120125]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2020-12-06 01:42 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (65 votes). Check out past polls.