fix: stop SCRIPT FLUSH from deadlocking against a borrowed interpreter - #8110
fix: stop SCRIPT FLUSH from deadlocking against a borrowed interpreter#8110vyavdoshenko wants to merge 1 commit into
Conversation
PR Summary by QodoPrevent SCRIPT FLUSH deadlocks with non-blocking interpreter reset
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can keep summaries lean with Finding overflow, which tucks the rest behind 'View more' Powered by Qodo |
🤖 Augment PR SummarySummary: Prevent
🤖 Was this summary useful? React with 👍 or 👎 |
Code Review by Qodo
🔴 High 1. Destruction leaks memory accounting
|
0cd0b7c to
54320cf
Compare
InterpreterManager::Reset()blocked until every borrowed interpreter was returned, soSCRIPT FLUSHinherited every lock its holders were waiting on. Reset no longer blocks: idle interpreters are destroyed inline, borrowed ones are retired and destroyed by whoever returns them.Three shapes, all reproduced on a debug build:
MULTI; EVAL "return 1" 0; SCRIPT FLUSH; EXEC- EXEC pre-borrows an interpreter and returns it only after the body ran, so it waits for itself.SCRIPTisNO_KEY_TRANSACTIONAL, so the EXEC runs as a global transaction: afterwards evenGEThangs and onlyPINGanswers.EVAL+SCRIPT FLUSH- the flusher holdsScriptMgr::mu_while waiting for an interpreter whose holder is blocked on that same mutex. All scripting wedges permanently.EVALholds an interpreter behind the global lock that a concurrentMULTI; SCRIPT FLUSH; EXECholds.