-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] should acquire db lock out of createLoadTask to avoid dead lock #55219
Conversation
Signed-off-by: kaijian.ding <[email protected]>
fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
Outdated
Show resolved
Hide resolved
The database lock is held outside the StreamLoadMgr and then call StreamLoadMgr with acquiring its write lock. StreamLoadMgr can't be aware of the database lock the caller holds. So the best practice of the StreamLoadMgr implementation is, DON'T TRY TO ACQUIRE DB/TABLE READ/WRITE LOCK under StreamLoadMgr's read/write lock. |
Signed-off-by: kaijian.ding <[email protected]>
fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
Outdated
Show resolved
Hide resolved
Signed-off-by: kaijian.ding <[email protected]>
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 9 / 9 (100.00%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
@Mergifyio backport branch-3.4 |
@Mergifyio backport branch-3.3 |
✅ Backports have been created
|
✅ Backports have been created
|
…ock (#55219) Signed-off-by: kaijian.ding <[email protected]> (cherry picked from commit 9af1024) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
…ock (#55219) Signed-off-by: kaijian.ding <[email protected]> (cherry picked from commit 9af1024) # Conflicts: # fe/fe-core/src/main/java/com/starrocks/load/streamload/StreamLoadMgr.java
…ock (backport #55219) (#55263) Signed-off-by: Kevin Xiaohua Cai <[email protected]> Co-authored-by: kaijianding <[email protected]> Co-authored-by: Kevin Xiaohua Cai <[email protected]>
…ock (backport #55219) (#55264) Signed-off-by: Kevin Xiaohua Cai <[email protected]> Co-authored-by: kaijianding <[email protected]> Co-authored-by: Kevin Xiaohua Cai <[email protected]>
Why I'm doing:
A dead lock issue is found:
Slow lock:
Thread "pool-21-thread-406" owns the database lock.
StreamLoadMgr.cleanSyncStreamLoadTasks()
tries to acquireStreamLoadMgr.lock.writeLock()
0x00007fb9905311a8Jstack:
Thread "thrift-server-pool-6208" owns the StreamLoadMgr.lock.writeLock(): 0x00007fb9905311a8 in
StreamLoadMgr.beginLoadTask()
StreamLoadMgr.beginLoadTask()
callStreamLoadMgr.createLoadTask()
who is trying to acquire database lockWhat I'm doing:
StreamLoadMgr.createLoadTask()
don't acquire database lock.StreamLoadMgr.beginLoadTask()
first acquire database lock and unlock, then acquireStreamLoadMgr.lock.writeLock()
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
Bugfix cherry-pick branch check: