Repository: zeppelin Updated Branches: refs/heads/branch-0.8 eb7969b0c -> 6ce81b54f
ZEPPELIN-3401. Deadlock while restarting interpreter ### What is this PR for? I suspect it is due to deadlock issue between LifecycleThread & CronJobThread: Thread | Locked | Waiting -- | -- | -- LifecycleThread | InterpreterGroup | Note CronJobThread | Note | Wait for Paragraph to finish (Paragraph can not finish because it needs the lock of InterpreterGroup This PR wold eliminate the necessary to lock on Note for LifecycleThread ### What type of PR is it? [Bug Fix ] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3401 ### How should this be tested? * First time? Setup Travis CI as described on https://zeppelin.apache.org/contribution/contributions.html#continuous-integration * Strongly recommended: add automated unit tests for any new or changed behavior * Outline any manual steps to test the PR here. ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jeff Zhang <zjf...@apache.org> Closes #2937 from zjffdu/ZEPPELIN-3401 and squashes the following commits: 5ffcc11 [Jeff Zhang] ZEPPELIN-3401. Deadlock while restarting interpreter (cherry picked from commit 3fb878bfaa59c33182ebc80fb48aabb73e06d0d1) Signed-off-by: Jeff Zhang <zjf...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/6ce81b54 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/6ce81b54 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/6ce81b54 Branch: refs/heads/branch-0.8 Commit: 6ce81b54f4f0736070cff8da58368a45dd611ae4 Parents: eb7969b Author: Jeff Zhang <zjf...@apache.org> Authored: Sun Apr 22 11:46:53 2018 +0800 Committer: Jeff Zhang <zjf...@apache.org> Committed: Thu Apr 26 16:09:15 2018 +0800 ---------------------------------------------------------------------- .../src/main/java/org/apache/zeppelin/notebook/Note.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/6ce81b54/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java index 4740abb..7a7b992 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Note.java @@ -103,6 +103,7 @@ public class Note implements ParagraphJobListener, JsonSerializable { private transient NotebookRepo repo; private transient SearchService index; private transient ScheduledFuture delayedPersist; + private transient Object delayedPersistLock = new Object(); private transient NoteEventListener noteEventListener; private transient Credentials credentials; private transient NoteNameListener noteNameListener; @@ -856,7 +857,7 @@ public class Note implements ParagraphJobListener, JsonSerializable { } private void startDelayedPersistTimer(int maxDelaySec, final AuthenticationInfo subject) { - synchronized (this) { + synchronized (delayedPersistLock) { if (delayedPersist != null) { return; } @@ -876,11 +877,10 @@ public class Note implements ParagraphJobListener, JsonSerializable { } private void stopDelayedPersistTimer() { - synchronized (this) { + synchronized (delayedPersistLock) { if (delayedPersist == null) { return; } - delayedPersist.cancel(false); } }