You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2018/04/26 08:06:58 UTC

zeppelin git commit: ZEPPELIN-3401. Deadlock while restarting interpreter

Repository: zeppelin
Updated Branches:
  refs/heads/master 1cea92ca3 -> 3fb878bfa


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 <zj...@apache.org>

Closes #2937 from zjffdu/ZEPPELIN-3401 and squashes the following commits:

5ffcc11 [Jeff Zhang] ZEPPELIN-3401. Deadlock while restarting interpreter


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/3fb878bf
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/3fb878bf
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/3fb878bf

Branch: refs/heads/master
Commit: 3fb878bfaa59c33182ebc80fb48aabb73e06d0d1
Parents: 1cea92c
Author: Jeff Zhang <zj...@apache.org>
Authored: Sun Apr 22 11:46:53 2018 +0800
Committer: Jeff Zhang <zj...@apache.org>
Committed: Thu Apr 26 16:06:54 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/3fb878bf/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 80c96e2..3dc2b99 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;
@@ -861,7 +862,7 @@ public class Note implements ParagraphJobListener, JsonSerializable {
   }
 
   private void startDelayedPersistTimer(int maxDelaySec, final AuthenticationInfo subject) {
-    synchronized (this) {
+    synchronized (delayedPersistLock) {
       if (delayedPersist != null) {
         return;
       }
@@ -881,11 +882,10 @@ public class Note implements ParagraphJobListener, JsonSerializable {
   }
 
   private void stopDelayedPersistTimer() {
-    synchronized (this) {
+    synchronized (delayedPersistLock) {
       if (delayedPersist == null) {
         return;
       }
-
       delayedPersist.cancel(false);
     }
   }