Project

General

Profile

Actions

Bug #782

closed

Static object in WRandom causes boost::random_device exception when forking

Added by Víctor López almost 13 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Target version:
Start date:
04/07/2011
Due date:
% Done:

100%

Estimated time:

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

main.cpp (549 Bytes) main.cpp Víctor López , 04/08/2011 10:30 AM
Actions #1

Updated by Wim Dumon almost 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.

Actions #2

Updated by Koen Deforche over 12 years ago

  • Target version set to 3.1.10
Actions #3

Updated by Koen Deforche over 12 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF