Bug #782
closedStatic object in WRandom causes boost::random_device exception when forking
100%
Description
I am having crashes when using WRandom after a call to ACE::daemonize.
It is probably due to the fact that in WRandom.C, line 53, there's a static instance of RandomDevice. Which in it's default constructor, initializes boost::random_device rnd.
After a fork, this structure is corrupted and if you attempt to access it you get the following exception:
boost::random_device: error while reading random-number pseudo-device /dev/urandom: Bad file descriptor
If there are other static instances there's a chance that other issues.
It would be fine if it was lazy initialized.
It works fine if I don't daemonize, or if I modifiy WRandom.cpp to not use boost.
Using Wt 3.1.8, gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 and ACE 5.7.1.
I attached an example of the issue.
Files
Updated by Wim Dumon over 13 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
A patch for this will appear in the public git soon. Can you verify that this works for you?
BR,
Wim.
Updated by Koen Deforche over 13 years ago
- Status changed from Resolved to Closed