[SERVER-11333] C++ __declspec( thread ) causes a crash in a managed windows environment Created: 23/Oct/13  Updated: 11/Jul/16  Resolved: 24/Oct/13

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Bug Priority: Major - P3
Reporter: Charlie Page Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File SERVER-11333-2.5.2.patch     Text File SERVER-11333.patch    
Issue Links:
Related
Operating System: ALL
Participants:

 Description   

The windows C++ driver crashes in the Windows managed environment with replica set connection.



 Comments   
Comment by Andrew Morrow (Inactive) [ 25/Oct/13 ]

david.x.burt@barclays.com: It was mentioned to me that you are currently using 2.5.2, rather than 2.5.3. We think you should stay with 2.5.2 for now, so I've re-formulated the patch against 2.5.2, attached above as SERVER-11333-2.5.2.patch. Sorry for the confusion.

Comment by Andrew Morrow (Inactive) [ 25/Oct/13 ]

david.x.burt@barclays.com: The attached patch should apply cleanly with 'git apply SERVER-11333.patch' against the mongodb source tree at tag r2.5.3 or later (up to commit 6332ae3 at minimum). It adds support for the --disable-declspec-thread option described above in this ticket.

If you could please verify that a driver built with this flag functions correctly within your managed environment it would be much appreciated.

Thanks,
Andrew

Comment by Andrew Morrow (Inactive) [ 24/Oct/13 ]

A new build flag has been added to SCons to address this issue: --disable-declspec-thread. Builds passing this flag will not use __declspec(thread) when building with MSVC. Instead we fall back to whatever implementation boost::thread_specific_ptr uses internally (presumably TlsAlloc, TlsSetValue, etc.). Note that if boost::thread_specific_ptr ever started using __declspec(thread) internally this problem would re-occur.

Note that this option should never be used to build the server or tools. It is only for building the C++ driver by way of the install-mongoclient target, and it exists only to facilitate using the C++ driver in a managed environment.

Comment by auto [ 24/Oct/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-11333 Add build flag to suppress use of __declspec(thread)
Branch: master
https://github.com/mongodb/mongo/commit/dd6d28a356d2768ed2b6d0e5bf8a510dfd561bdf

Comment by auto [ 24/Oct/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-11333 Use configure time checks and posix feature tests to select TSP implementation
Branch: master
https://github.com/mongodb/mongo/commit/5682288d907ae593a4ab12d7cedab90cff2c3c04

Generated at Thu Feb 08 03:25:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.