Skip to content

Commit 3a3167a

Browse files
Jay Edgarmeta-codesync[bot]
authored andcommitted
Add defensive check for null timeout manager in waitForActionable
Summary: Adds a defensive check in MysqlOperationImpl::waitForActionable() to gracefully fail if getTimeoutManager() returns null. This can happen during client shutdown when AsyncConnection::~AsyncConnection() schedules a reset operation, but the EventBase is already being destroyed. Without this check, the operation would crash with an assertion failure in AsyncTimeout::scheduleTimeout() when it tries to use a null timeoutManager_. With this fix, the operation fails gracefully with OperationResult::Failed instead of crashing. Reviewed By: rban1 Differential Revision: D94744809 fbshipit-source-id: 7c9d067b22d1ca84ad4386aedf7f864dc10fff3d
1 parent 2b58747 commit 3a3167a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

third-party/squangle/src/squangle/mysql_client/mysql_protocol/MysqlOperationImpl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ MysqlConnection* MysqlOperationImpl::getMysqlConnection() {
6161
void MysqlOperationImpl::waitForActionable() {
6262
DCHECK(isInEventBaseThread());
6363

64+
// Check if timeout manager is still valid (EventBase not shutting down)
65+
// This can happen if an operation is scheduled during client shutdown
66+
if (!getTimeoutManager()) {
67+
completeOperation(OperationResult::Failed);
68+
return;
69+
}
70+
6471
auto event_mask = getMysqlConnection()->getReadWriteState();
6572

6673
if (hasOpElapsed(getTimeout())) {

0 commit comments

Comments
 (0)