Opened 7 years ago

Last modified 5 years ago

#12137 new Bugs

boost::interprocess::intermodule_singleton initialization failed

Reported by: Valentin Shtronda <valiko.ua@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.60.0 Severity: Showstopper
Keywords: System EventLog get_last_bootup_time get_shared_dir Cc:

Description

I'm getting exception "boost::interprocess::intermodule_singleton initialization failed" when trying to use Boost Interprocess library, even when I run any example from the library doc. Debugging showed that the library fails to find event 6005 in System's EventLog, so it cannot obtain system boot-up time, which it uses to create shared dir.

I used Windows Event Viewer to check that indeed, there is no such event in my system at this moment. I didn't delete it, so I suppose that Windows itself cleans old events. My system's uptime is more than 40 days. I see that my System Event Log is configured to be maximum 20MB (it's default, I didn't change it) and it's currently 20MB, so it explains everything.

Since it's normal situation, I believe the library should use other way (in addition to, or instead of current way) to get bootup time. For example, GetTickCount64 or System Up Time performance counter (https://msdn.microsoft.com/en-us/library/windows/desktop/ms725496(v=vs.85).aspx).

What is worse, I cannot reboot at the moment and need to proof-of-concept IPC on Windows for our project, and this is my only Windows box...

The only quick workaround I see is to patch get_last_bootup_time function to use GetTickCount64.

Attachments (1)

win32_api.hpp.patch (2.3 KB ) - added by Valentin Shtronda <valiko.ua@…> 6 years ago.
The patch with my fix/workaround to apply on top of version 1.60.

Download all attachments as: .zip

Change History (7)

comment:1 by Valentin Shtronda <valiko.ua@…>, 7 years ago

Version: Boost 1.61.0Boost 1.60.0

comment:2 by Valentin Shtronda <valiko.ua@…>, 7 years ago

I also noticed that boost::interprocess::winapi::get_last_bootup_time() returns true (and stamp remains empty) if OpenEventLogA() fails. Is it by intent?

comment:3 by anonymous, 6 years ago

This appears to bea duplicate of #11480

comment:4 by Valentin Shtronda <valiko.ua@…>, 6 years ago

Indeed, same root cause.

So the bug is old, from version 1.57 at least...

by Valentin Shtronda <valiko.ua@…>, 6 years ago

Attachment: win32_api.hpp.patch added

The patch with my fix/workaround to apply on top of version 1.60.

comment:5 by Valentin Shtronda <valiko.ua@…>, 6 years ago

Note that this fix will not compile on Windows prior to Vista or Server 2008, which do not have GetTickCount64.

comment:6 by anonymous, 5 years ago

I've been having this problem with boost 1.64.0, running my app on a Win 10 Home edition. After applying the patch on win32_api.h and rebuilding boost and then my app, the problem went away.

Note: See TracTickets for help on using tickets.