Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3104 closed Bugs (fixed)

Preprocessing with Boost::wave crashes when calling from multiple threads

Reported by: www.brutaltruth.ru Owned by: Hartmut Kaiser
Milestone: Boost 1.40.0 Component: wave
Version: Boost 1.39.0 Severity: Problem
Keywords: wave spirit multithreading Cc:

Description

1) While using boost::wave from within multiple threads - it crashes.

2) When using from one thread only - everything is OK.

3) I have defined:

#define BOOST_WAVE_SUPPORT_THREADING 1 #define BOOST_SUPPORT_THREADS in my stdafx.h file

I am using MSVS 2008 (CreateThread in a for loop) and MSVS 2010 (ppl test using parallel_for loop)

Please see my attached sample file. write included sample1.h - sample4.h files to c:\test\samples directory (or change path in code).

Thank you.

Attachments (1)

wave_bug_MT.zip (80.5 KB ) - added by www.brutaltruth.ru 13 years ago.
MSVS2008 project

Download all attachments as: .zip

Change History (9)

by www.brutaltruth.ru, 13 years ago

Attachment: wave_bug_MT.zip added

MSVS2008 project

comment:1 by Hartmut Kaiser, 13 years ago

Resolution: fixed
Status: newclosed

Thanks for this report. It has been fixed recently and the patch will be part of Boost V1.40.0.

Regards Hartmut

in reply to:  1 comment:2 by anonymous, 13 years ago

Replying to hkaiser:

Thanks for this report. It has been fixed recently and the patch will be part of Boost V1.40.0.

Regards Hartmut

I have tested again with boost trunk and the problem is still there. Wave changelog lists 2 "race conditions" fixed. Is it related to this bug or the changes are not in the trunk yet?

comment:3 by anonymous, 13 years ago

The problem with your code is that you are including the Spirit headers files independently and before including Wave. Wave enables Spirit thread safety whenever it is compiled in multi-threaded mode. But if you include Spirit before Wave you need to switch Spirit (and probably Phoenix) into multi-threaded mode yourself. I was able to run your example successfully by adding:

#define BOOST_SPIRIT_THREADSAFE 1
#define PHOENIX_THREADSAFE 1      // needed only if you use Phoenix

to your stdafx.h before including Spirit.

HTH Regards Hartmut

comment:4 by www.brutaltruth.ru, 13 years ago

Thank you, Hartmut!

comment:5 by www.brutaltruth.ru, 13 years ago

Hartmut, i have tested my sample with defines that you suggested - it still causes Heap corruption problems (but no problems with asserts as sometimes before). Actually sample i attached for you is OK - there are only couple of little files used to be precompiled. As i add more files to precompile - heap corruption dialog pops back again. I am sorry for annoying you, just want Wave to be ok in next boost release.

in reply to:  5 comment:6 by Hartmut Kaiser, 13 years ago

Replying to www.brutaltruth.ru:

Hartmut, i have tested my sample with defines that you suggested - it still causes Heap corruption problems (but no problems with asserts as sometimes before). Actually sample i attached for you is OK - there are only couple of little files used to be precompiled. As i add more files to precompile - heap corruption dialog pops back again.

Could you provide a minimal example I could use to reproduce your problem?

I am sorry for annoying you, just want Wave to be ok in next boost release.

No annoyance at all. I appreciate you patience.

Regards Hartmut

comment:7 by tony , 13 years ago

Thank you, Hartmut. Just compile the sample i sent you in Release settings and run it several times (3 or 4 and Heap corruption pops). Good bye.

in reply to:  7 comment:8 by Hartmut Kaiser, 13 years ago

Replying to tony :

Just compile the sample i sent you in Release settings and run it several times (3 or 4 and Heap corruption pops).

I'm sorry, but I'm not able to reproduce your problems even when running in release mode a couple of times (I set up an endless loop executing your example and it ran for over an hour just fine). Any other idea how I could reproduce this effect?

Regards Hartmut

Note: See TracTickets for help on using tickets.