yuqi1129 opened a new issue, #13465: URL: https://github.com/apache/gravitino/issues/13465
### What would you like to be improved? `SegmentedLock.withGlobalLock` takes the `globalGate` write lock. A caller already inside a `withLock` action on the same instance holds the read lock, and a `ReentrantReadWriteLock` read lock cannot upgrade, so the call parks forever. The javadoc added in #13400 already states the rule: > Must not be called from inside a `withLock` action on the same instance: the read lock cannot upgrade to the write lock, so such a call would deadlock. but nothing enforces it, and the javadoc alone did not prevent the violation. #13462 is what that costs in practice: one test broke the rule, `:core:test` produced no further output, and the `build (17)` job on `cd72eac711` was cancelled after 1h47m. A deadlock reports nothing — no failing test name, no stack trace, no clue which call is at fault. Two PRs that were each green in isolation combined into a silent two-hour hang. ### How should we improve? `ReentrantReadWriteLock.getReadHoldCount()` reports the calling thread's own read holds, so the violation is detectable in O(1) before the write lock is requested. Reject the re-entrant call with an `IllegalStateException` that names the rule, instead of parking on it. Measured on a branch carrying this guard with #13463 reverted: the same violation fails in 58s naming `TestRelationalEntityStoreBatchGetLateFill.testBatchGetRemovesValueWrittenAfterClear`, instead of hanging indefinitely. This is defense-in-depth rather than a fix for anything currently broken: #13463 removes the only present violation. The check runs once per whole-cache clear on a field the lock already maintains, so it costs nothing measurable. Follow-up to #13462 and #13463. -- 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]
