GitHub user benoyantony opened a pull request:
https://github.com/apache/zeppelin/pull/1778
ZEPPELIN-1834 Deadlock in Zeppelin when running multiple notes via scâ¦
### What is this PR for?
What is this PR for?
To prevent deadlock when different notes are run simultaneously by the
scheduler.
When a note is run as by scheduler, thread T1 calls Note.runAll() and lock
on the paragraphs is acquired. Later, T1 tries to obtain locks on paragraphs
of other notes as part of status update. If scheduler starts running another
note using a different thread, this sequence will result in deadlock.
T1 -> locks N1.paragraphs , needs to obtain N2.paragraphs as part of
broadcastUpdateNotebookJobInfo
T2-> locks N2.paragraphs , needs to obtain N1.paragraphs as part of
broadcastUpdateNotebookJobInfo
T1 is waiting for N2.paragraphs holding lock on N1.paragraphs.
T2 is waiting for N1.paragraphs holding lock on N2.paragraphs.
The relevant thread dump is below:
"DefaultQuartzScheduler_Worker-6":
at org.apache.zeppelin.notebook.Note.getParagraphs(Note.java:537)
- waiting to lock <0x00000000c06cb168> (a java.util.ArrayList)
at
org.apache.zeppelin.notebook.Notebook.getJobListByUnixTime(Notebook.java:734)
at
org.apache.zeppelin.socket.NotebookServer.broadcastUpdateNotebookJobInfo(NotebookServer.java:423)
at
org.apache.zeppelin.socket.NotebookServer$ParagraphListenerImpl.afterStatusChange(NotebookServer.java:1468)
at org.apache.zeppelin.scheduler.Job.setStatus(Job.java:150)
at
org.apache.zeppelin.scheduler.RemoteScheduler.submit(RemoteScheduler.java:148)
at org.apache.zeppelin.notebook.Note.run(Note.java:510)
at org.apache.zeppelin.notebook.Note.runAll(Note.java:484)
- locked <0x00000000c071ad00> (a java.util.ArrayList)
at
org.apache.zeppelin.notebook.Notebook$CronJob.execute(Notebook.java:786)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
- locked <0x00000000c0864798> (a java.lang.Object)
"DefaultQuartzScheduler_Worker-7":
at org.apache.zeppelin.notebook.Note.getParagraphs(Note.java:537)
- waiting to lock <0x00000000c071ad00> (a java.util.ArrayList)
at
org.apache.zeppelin.notebook.Notebook.getJobListByUnixTime(Notebook.java:734)
at
org.apache.zeppelin.socket.NotebookServer.broadcastUpdateNotebookJobInfo(NotebookServer.java:423)
at
org.apache.zeppelin.socket.NotebookServer$ParagraphListenerImpl.afterStatusChange(NotebookServer.java:1468)
at org.apache.zeppelin.scheduler.Job.setStatus(Job.java:150)
at
org.apache.zeppelin.scheduler.RemoteScheduler.submit(RemoteScheduler.java:148)
at org.apache.zeppelin.notebook.Note.run(Note.java:510)
at org.apache.zeppelin.notebook.Note.runAll(Note.java:484)
- locked <0x00000000c06cb168> (a java.util.ArrayList)
at
org.apache.zeppelin.notebook.Notebook$CronJob.execute(Notebook.java:786)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
- locked <0x00000000c0864a98> (a java.lang.Object)
Found 1 deadlock.
### What type of PR is it?
Bug Fix
### Todos
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1834
[ZEPPELIN-1834]
### How should this be tested?
Manual testing steps:
* â¨Create 2 notes.
* Set a scheduler on each of them to run at the same time.
* Deadlock will occur and Zeppelin hangs.
### Screenshots (if appropriate)
### Questions:
* Does the licenses files need update? NO
* Is there breaking changes for older versions? NO
* Does this needs documentation? NO
â¦heduler
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/benoyantony/zeppelin deadlock
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/1778.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1778
----
commit 96e3cfb3bab8544d474bfbb0077d6566ff9e22ca
Author: Benoy Antony <[email protected]>
Date: 2016-12-16T21:28:38Z
ZEPPELIN-1834 Deadlock in Zeppelin when running multiple notes via scheduler
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---