[SERVER-77788] tapError should avoid throwing unnecessary exceptions Created: 05/Jun/23  Updated: 29/Oct/23  Resolved: 21/Jun/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 7.1.0-rc0, 6.0.6, 5.0.18, 7.0.0-rc2
Fix Version/s: 7.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Alberto Massari Assignee: Alberto Massari
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QE 2023-06-12, QE 2023-06-26
Participants:
Linked BF Score: 8

 Description   

The tapError method in a Future object is supposed to watch the generation of an error, but if it throws an exception during its processing, the process crashes (not always, though, maybe there are alternative code paths). The code at tapError can throw an exception if the request has an non-string $db field



 Comments   
Comment by Githook User [ 20/Jun/23 ]

Author:

{'name': 'Alberto Massari', 'email': 'alberto.massari@mongodb.com', 'username': 'albymassari'}

Message: SERVER-77788 Avoid that tapError can throw an exception
Branch: master
https://github.com/mongodb/mongo/commit/4824695a3f8af8eb22ddf6cc494c56b168f5f99e

Comment by Alberto Massari [ 05/Jun/23 ]

I am testing a fix where the getDatabase() call is inside a try/catch, and uses an empty string if it isn't a valid database name

Comment by Max Hirschhorn [ 05/Jun/23 ]

What change is this ticket proposing to make? The lambda function given to Future::tapError() is expected to be noexcept. Maybe log messages should use a different form of OpMsgRequest::getDatabase() which won't throw an exception?

Generated at Thu Feb 08 06:36:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.