Opened 12 years ago
Closed 12 years ago
#4736 closed Bugs (fixed)
MinGW: tss crashes (SIGSEGV) in ~thread_specific_ptr
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Boost 1.45.0 | Component: | thread |
Version: | Boost 1.44.0 | Severity: | Showstopper |
Keywords: | mingw tss SIGSEGV thread_specific_ptr destructor set_tss_data | Cc: | jim@…, Bryce Adelstein Lelbach |
Description
tss crashes with a SIGSEGV in the destructor of thread_specific_ptr under mingw, inside boost::detail::set_tss_data().
After main() exits, apparently cleanup_tls_key() gets called some time prior to the thread_specific_ptr clean-up.
Then inside set_tss_data(), get_or_make_current_thread_data() returns 0, and dereferencing it (current_thread_data->tss_data, line 589) causes the crash.
get_or_make_... actually makes one, but get_current_thread_data() won't return it because current_thread_tls_key is reset. So there's a little resource leak here, too. Though I don't think that's important this late in the program's termination sequence, you could check current_thread_tls_key explicitly in get_or_make_... and avoid it.
Attachments (1)
Change History (13)
by , 12 years ago
Attachment: | tss-mingw-2010-10-14.patch added |
---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Milestone: | To Be Determined → Boost-1.45.0 |
---|---|
Severity: | Problem → Showstopper |
comment:3 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Jim, I'm having trouble reproducing this, and I can't find any references to this in the build bot logs. Can you provide self-contained code that produces this error for you? (understandably if there is a race condition, this could be hard to reproduce, but if you provide me with a test case that should reproduce this, I'll run it on my Windows machine and add it to the test matrix).
comment:4 by , 12 years ago
Cc: | added |
---|
comment:5 by , 12 years ago
RE: worksforme
Note this log (live as of 2010/10/21 3PM CST):
Run [2010-10-21 16:24:48 UTC]: fail Running 6 test cases... tss_instances = 0; tss_total = 5 tss_instances = 0; tss_total = 5 *** No errors detected
Notice both "No errors detected" and "Run [...]: fail" above it. It exited main() just fine, then crashed.
comment:6 by , 12 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
comment:7 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Even though MinGW-32 still fails the test_tss_lib test, it's now for a different reason, the program terminates cleanly. Fixed.
comment:8 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:9 by , 12 years ago
f.y.i, Several of the Wave regression tests are failing on the release branch with a similar looking error.
comment:10 by , 12 years ago
If this_thread::get_id() gets called before a boost::thread is created, no call to set_current_thread_data() would have been made, and you'd see this symptom.
FWIW, also noticed that the "throw thread_resource_error()" in get_or_make_current_thread_data() is inconsistent with other uses: "boost::throw_exception(thread_resource_error());"
comment:11 by , 12 years ago
r66518 fixes this ticket as originally reported. Please reopen if other libraries are still failing.
comment:12 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
There seems to be a race condition involved, as I'm now able to pass the test_tss_lib test on my machine (un-patched) that reliably failed it earlier in the week. As you can see, though, the trunk test for gcc-mingw-4.3.3 also failed this same test and with the same symptoms.