[bugfix](deadlock) pipelinex map lock should only scope in map not about pipelinectx's cancel method (#32622)

both global lock in fragment mgr should only protect the map logic, could not use it to protect cancel method.
fragment ctx cancel method should be protected by a lock.
query ctx cancel --> pipelinex fragment cancel ---> query ctx cancel will dead lock.
This commit is contained in:
yiguolei
2024-03-21 22:11:06 +08:00
committed by yiguolei
parent 6462d913ca
commit 6b54171778
7 changed files with 86 additions and 66 deletions

View File

@ -3271,9 +3271,6 @@ public class Coordinator implements CoordInterface {
// return true if cancel success. Otherwise, return false
private synchronized boolean cancelFragment(Types.PPlanFragmentCancelReason cancelReason) {
if (!this.hasCanceled) {
return false;
}
for (RuntimeProfile profile : taskProfile) {
profile.setIsCancel(true);
}
@ -3288,6 +3285,7 @@ public class Coordinator implements CoordInterface {
try {
BackendServiceProxy.getInstance().cancelPipelineXPlanFragmentAsync(brpcAddress,
this.fragmentId, queryId, cancelReason);
this.hasCanceled = true;
} catch (RpcException e) {
LOG.warn("cancel plan fragment get a exception, address={}:{}", brpcAddress.getHostname(),
brpcAddress.getPort());