-
Notifications
You must be signed in to change notification settings - Fork 990
[KYUUBI #7301] Fix engine not killed after deregisterEngine #7302
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -367,6 +367,18 @@ private[kyuubi] class EngineRef( | |
| val msg = s"Deleting engine node:$sn" | ||
| info(msg) | ||
| discoveryClient.delete(s"$engineSpace/${sn.nodeName}") | ||
|
|
||
| if (shareLevel != CONNECTION && builder != null && engineManager != null) { | ||
| try { | ||
| val appMgrInfo = builder.appMgrInfo() | ||
| engineManager.killApplication(appMgrInfo, engineRefId, Some(appUser)) | ||
| info(s"Killed engine process for $engineRefId with share level $shareLevel") | ||
| } catch { | ||
| case e: Exception => | ||
| warn(s"Error killing engine process for $engineRefId", e) | ||
| } | ||
| } | ||
|
Comment on lines
+371
to
+380
|
||
|
|
||
| (true, msg) | ||
| } else { | ||
| val msg = s"Engine node:$sn is not matched with host&port[$hostPort]" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical bug: The condition
builder != nullwill prevent killing engines in the most common deregister scenarios. Thebuilderfield is only set when this EngineRef instance creates a new engine (line 216 in thecreatemethod). However, when an existing engine is discovered viagetOrCreate, thebuilderremains null. This means when deregister is called for discovered engines (the exact scenario described in issue #7301), the engine process won't be killed.Additionally, even if builder were non-null, calling
builder.appMgrInfo()is incorrect here because the appMgrInfo should be retrieved from the ServiceNodeInfo that was just fetched from ZooKeeper. The correct pattern (as shown in AdminResource.scala:312) is to get appMgrInfo fromsn.attributes.get(KyuubiReservedKeys.KYUUBI_ENGINE_APP_MGR_INFO_KEY).The fix should:
sn.attributes