[SERVER-9773] call _CrtSetReportMode to avoid hanging debug builds Created: 23/May/13  Updated: 10/Dec/14  Resolved: 23/May/13

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

Type: Improvement Priority: Major - P3
Reporter: Eric Milkie Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

The default behavior if an internal assert is hit in the Visual Studio CRTL is to pop up an interactive Abort, Retry, Ignore window. This hangs a build runnings tests forever until someone manually fixes it.

We can change the default behavior by calling:
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
...at process startup.
This can be done in a MONGO_INITIALIZER.



 Comments   
Comment by Tad Marshall [ 24/May/13 ]

The code in platform_init.cpp stopped the issue that I was seeing (and put the info in the log file instead of on the screen), but if there are additional cases not covered feel free to enhance the code.

Comment by Eric Milkie [ 23/May/13 ]

Yes, it achieves the same goal. (Although it looks like we might want to be using _CrtSetReportHook2())
This code will not be run for any program not calling runGlobalInitializers(), which is the case for today's build hang. After we solve SERVER-8250, we'll be able to run this code for all auxiliary programs and we should no longer hang.

Comment by Tad Marshall [ 23/May/13 ]

Is this like the code in platform_init.cpp?

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