Browse Source

fix dead server cannot stop (#6046)

2.0.7-release
Wenjun Ruan 3 years ago committed by GitHub
parent
commit
839d6054ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java
  2. 1
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
  3. 1
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/RetryReportTaskStatusThread.java
  4. 1
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java

11
dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java

@ -47,6 +47,7 @@ import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.apache.curator.retry.ExponentialBackoffRetry; import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.CloseableUtils; import org.apache.curator.utils.CloseableUtils;
import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL; import org.apache.zookeeper.data.ACL;
@ -195,12 +196,7 @@ public class ZookeeperRegistry implements Registry {
@Override @Override
public void remove(String key) { public void remove(String key) {
delete(key);
try {
client.delete().deletingChildrenIfNeeded().forPath(key);
} catch (Exception e) {
throw new RegistryException("zookeeper remove error", e);
}
} }
@Override @Override
@ -269,6 +265,9 @@ public class ZookeeperRegistry implements Registry {
client.delete() client.delete()
.deletingChildrenIfNeeded() .deletingChildrenIfNeeded()
.forPath(nodePath); .forPath(nodePath);
} catch (KeeperException.NoNodeException ignore) {
// the node is not exist, we can believe the node has been removed
} catch (Exception e) { } catch (Exception e) {
throw new RegistryException("zookeeper delete key error", e); throw new RegistryException("zookeeper delete key error", e);
} }

1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java

@ -181,6 +181,7 @@ public class WorkerServer implements IStoppable {
this.nettyRemotingServer.close(); this.nettyRemotingServer.close();
this.workerRegistryClient.unRegistry(); this.workerRegistryClient.unRegistry();
this.alertClientService.close(); this.alertClientService.close();
this.springApplicationContext.close();
} catch (Exception e) { } catch (Exception e) {
logger.error("worker server stop exception ", e); logger.error("worker server stop exception ", e);
} }

1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/RetryReportTaskStatusThread.java

@ -49,6 +49,7 @@ public class RetryReportTaskStatusThread implements Runnable {
public void start(){ public void start(){
Thread thread = new Thread(this,"RetryReportTaskStatusThread"); Thread thread = new Thread(this,"RetryReportTaskStatusThread");
thread.setDaemon(true);
thread.start(); thread.start();
} }

1
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java

@ -123,6 +123,7 @@ public class WorkerManagerThread implements Runnable {
public void start() { public void start() {
Thread thread = new Thread(this, this.getClass().getName()); Thread thread = new Thread(this, this.getClass().getName());
thread.setDaemon(true);
thread.start(); thread.start();
} }

Loading…
Cancel
Save