Copilot commented on code in PR #13232:
URL: https://github.com/apache/trafficserver/pull/13232#discussion_r3346931288


##########
src/traffic_server/traffic_server.cc:
##########
@@ -287,6 +288,11 @@ struct AutoStopCont : public Continuation {
       jsonrpcServer->stop_thread();
     }
 
+    // Flush the in-memory cache directory to disk
+    if (cacheProcessor.IsCacheEnabled() == CacheInitState::INITIALIZED) {
+      sync_cache_dir_on_shutdown();
+    }
+

Review Comment:
   `sync_cache_dir_on_shutdown()` is effectively non-reentrant: it eventually 
calls `StripeSM::shutdown()`, which takes the stripe mutex via 
`MUTEX_TAKE_LOCK()` and intentionally never releases it (see 
`src/iocore/cache/StripeSM.cc:1321-1337`). If `AutoStopCont` runs more than 
once (e.g., multiple SIGTERM/SIGINT deliveries scheduling multiple stop 
events), the second invocation can deadlock while trying to acquire 
already-held stripe locks, potentially hanging shutdown.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to