[SERVER-35138] service_state_machine.cpp should log a backtrace if there's an uncaught exception Created: 21/May/18  Updated: 08/Jan/24  Resolved: 10/Jan/19

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 4.0.7, 4.1.7

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Jonathan Ma
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File exception_stack_trace_current.txt     Text File exception_stack_trace_new.txt     Text File exception_stack_trace_no_handler.txt    
Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: Service Arch 2018-10-22, Service Arch 2018-11-05, Service Arch 2018-11-19, Service Arch 2018-12-03, Service Arch 2018-12-17, Service Arch 2018-12-31, Service Arch 2019-01-14
Participants:
Linked BF Score: 16

 Description   

While the backtrace itself won't be particular helpful in debugging the failure (as the stack has already been unwound) it will make it so the automated tooling to extract relevant log messages can find the uncaught exception message. The only log message that appears is the following:

[ReplicaSetFixture:job0:secondary2] 2018-05-20T12:58:19.763+0000 E NETWORK  [conn118] Uncaught std::exception: basic_string::_M_create, terminating

https://logkeeper.mongodb.org/lobster/build/7b9af1499f010b4d302f9f2e2ec3ebba/all?f=10ReplicaSetFixture%3Ajob0%3Asecondary2&bookmarks=0%2C938783

We could likely instead just call std::terminate() inside the catch-block as myTerminate() already logs details about the exception as well as a backtrace of where it was caught.



 Comments   
Comment by Githook User [ 13/Mar/19 ]

Author:

{'name': 'Jonathan Ma', 'email': 'jonathan.ma@mongodb.com', 'username': 'thejonathanma'}

Message: SERVER-35138 service_state_machine will log backtrace for uncaught exceptions

(cherry picked from commit ae66e32d6d4f22e8958d5e0b8aa47a2602ce1210)
Branch: v4.0
https://github.com/mongodb/mongo/commit/e77f1b2475391d2031ee1c8416121c1a40502caa

Comment by Githook User [ 10/Jan/19 ]

Author:

{'email': 'jonathan.ma@mongodb.com', 'name': 'Jonathan Ma'}

Message: SERVER-35138 service_state_machine will log backtrace for uncaught exceptions
Branch: master
https://github.com/mongodb/mongo/commit/ae66e32d6d4f22e8958d5e0b8aa47a2602ce1210

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