[SERVER-25240] set_terminate() should be done for every thread under Windows Created: 23/Jul/16  Updated: 23/Aug/19  Resolved: 23/Aug/19

Status: Closed
Project: Core Server
Component/s: Portability
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Bug Priority: Critical - P2
Reporter: Benety Goh Assignee: ADAM Martin (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-32935 improve exception handling in SyncTai... Closed
is related to SERVER-25233 ThreadPool should log escaped excepti... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-08-12, Dev Tools 2019-08-26
Participants:
Linked BF Score: 0

 Comments   
Comment by Githook User [ 23/Aug/19 ]

Author:

{'name': 'ADAM David Alan Martin', 'email': 'adam.martin@10gen.com', 'username': 'adamlsd'}

Message: SERVER-25240 Make `stdx::set_terminate` which works on windows.

The `stdx::set_terminate` primitive, on windows, wraps the per-thread
terminate handler and emulates a single global terminate handler.
Branch: master
https://github.com/mongodb/mongo/commit/088f6faa006b8414fe5b7197a2ae18c3cc0efdc9

Comment by Andy Schwerin [ 25/Apr/18 ]

Could we just make our abort signal handler do all the same stuff that the terminate handler does, and not install a terminate handler at all? std::terminate calls std::abort() if you don't register your own terminate handler, IIRC.

Comment by Andrew Morrow (Inactive) [ 23/Jul/16 ]

We could get some milage, perhaps, out of using the stdx::thread wrapper to set the terminate handler in all threads created that way, on Windows. That wouldn't address threads created by other means, most notably the ingress networking threads (though we could address those either by switching them to use stdx::thread, or explicitly setting the terminate handler there too).

Comment by Andy Schwerin [ 23/Jul/16 ]

The problem is that msvc sets the terminate handler per-thread, instead of per-process. It's an acknowledged deviation from the standard that they are not presently planning to fix.

Generated at Thu Feb 08 04:08:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.