Is it safe after fork() or not?
Closed this issue ยท 1 comments
Hiiii dogstaters! ๐ฉ๐
I was reading your README's 5.x pitfalls section about fork()
and got confused.
The bullet point says that the sender thread is re-created after fork()
, which seems to be correct according to my tests, and also 14c76e3.
However, below it, there is a paragraph saying that, if I'm using Unicorn (which I am), then I should instantiate dogstats on the workers, not on the master process ~ that is, instantiate dogstats only after fork()
, not before!
There is even a link to a comment from another user who instantiated dogstats on the master process, before the fork()
, and had problems because the child processes didn't have the sender thread running...
So what is the current behaviour of 5.4.0? Is it safe for me to use an existing instance after fork()
, or should I free and recreate my instance on each child process?
Thanksss!!1 โจ
You're right -- that warning about unicorn is outdated.