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
ZEPPELIN-3411 Long running logic inside synchronized block in InterpreterSettingManager #2935
Conversation
//clean up metaInfos | ||
intpSetting.setInfos(null); | ||
copyDependenciesFromLocalPath(intpSetting); | ||
intpSetting.closeInterpreters(user, noteId); |
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.
@zjffdu It was the original problem.
This is not a critial issue when running normally. But in case of problemistic situation like restarting forcibly to stop long running job of SparkInterpreter, some logic hangs inside synchronized block. |
Do you have jstack so that I can understand what the exact problem is ? |
@zjffdu Let me make it |
@zjffdu I've received this issue report from one of my colleagues that he ran a wrong code to read all of the data from a large directory and it took for 20mins with a spark job and he tried to stop a spark interpreter. and Then he tried to create a new note, but he couldn't see an interpreter lists from creating note page and a list-interpreter when clicking a button on a note. BUT I've tried to make it with current master into my local but it fails because 'restart' always work fine. It looks only until 0.7.3. Generally, this code doesn't a problem anymore in current master and branch-0.8, but this kind of synchronized blocks don't look good. I prefer to change it but it's not a bug now. What do you think of it? |
@@ -103,6 +104,7 @@ | |||
*/ | |||
private final Map<String, InterpreterSetting> interpreterSettings = | |||
Maps.newConcurrentMap(); | |||
private final ReentrantReadWriteLock interpreterSettingsLock = new ReentrantReadWriteLock(); |
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.
Actually interpreterSettings is ConcurrentHashMap, I think we don't need extra lock here.
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.
Yes, I thought it and wanted to confirm it. Then, I'll remove all of the locks related to interpreterSettings in this class.
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.
Fixed
…s implemented by currentHashMap
Removed all of the synchronized blocks from |
closeThreads.add(t); | ||
} | ||
Collection<InterpreterSetting> intpSettings = interpreterSettings.values(); | ||
for (final InterpreterSetting intpSetting : intpSettings) { |
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.
Merge them into one line
for (InterpreterSetting intpSetting : interpreterSettings.values()) {
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.
Fixed
@@ -24,6 +24,7 @@ | |||
import com.google.gson.Gson; | |||
import com.google.gson.GsonBuilder; | |||
import com.google.gson.reflect.TypeToken; | |||
import java.util.concurrent.locks.ReentrantReadWriteLock; |
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.
this could be removed
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.
Fixed
THanks @jongyoul Just several minor issues, rest look good to me. |
Simplified `for` loop
After finishing CI, I'll merge it |
Test passed. https://travis-ci.org/jongyoul/zeppelin/builds/369961193 Will merge it |
…eterSettingManager ### What is this PR for? Removing redundant synchronized code to avoid blocking other logics. ### What type of PR is it? [Bug Fix] ### Todos * [x] - Change synchronized block to read/write lock ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3411 ### How should this be tested? * Current tests should be passed ### 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: Jongyoul Lee <jongyoul@gmail.com> Closes apache#2935 from jongyoul/ZEPPELIN-3411 and squashes the following commits: 3b90155 [Jongyoul Lee] Removed unused `import` statements Simplified `for` loop 4691301 [Jongyoul Lee] Removed lock/synchronized codes because interpreterSettings already is implemented by currentHashMap 24be692 [Jongyoul Lee] Removed all synchronized blocks and replace them to read/write lock
are you going to merge that into branch-0.8 as well? |
@weand Oops. I was confused with another issue. I’ll cherry-pick this into 0.8 |
…eterSettingManager ### What is this PR for? Removing redundant synchronized code to avoid blocking other logics. ### What type of PR is it? [Bug Fix] ### Todos * [x] - Change synchronized block to read/write lock ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3411 ### How should this be tested? * Current tests should be passed ### 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: Jongyoul Lee <jongyoul@gmail.com> Closes #2935 from jongyoul/ZEPPELIN-3411 and squashes the following commits: 3b90155 [Jongyoul Lee] Removed unused `import` statements Simplified `for` loop 4691301 [Jongyoul Lee] Removed lock/synchronized codes because interpreterSettings already is implemented by currentHashMap 24be692 [Jongyoul Lee] Removed all synchronized blocks and replace them to read/write lock
…eterSettingManager Removing redundant synchronized code to avoid blocking other logics. [Bug Fix] * [x] - Change synchronized block to read/write lock * https://issues.apache.org/jira/browse/ZEPPELIN-3411 * Current tests should be passed * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Jongyoul Lee <jongyoul@gmail.com> Closes apache#2935 from jongyoul/ZEPPELIN-3411 and squashes the following commits: 3b90155 [Jongyoul Lee] Removed unused `import` statements Simplified `for` loop 4691301 [Jongyoul Lee] Removed lock/synchronized codes because interpreterSettings already is implemented by currentHashMap 24be692 [Jongyoul Lee] Removed all synchronized blocks and replace them to read/write lock (cherry picked from commit 6559c5e) Change-Id: Ic28a3e9cf8ec93c84596861716c3cc25dedd96f5
…eterSettingManager ### What is this PR for? Removing redundant synchronized code to avoid blocking other logics. ### What type of PR is it? [Bug Fix] ### Todos * [x] - Change synchronized block to read/write lock ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3411 ### How should this be tested? * Current tests should be passed ### 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: Jongyoul Lee <jongyoul@gmail.com> Closes apache#2935 from jongyoul/ZEPPELIN-3411 and squashes the following commits: 3b90155 [Jongyoul Lee] Removed unused `import` statements Simplified `for` loop 4691301 [Jongyoul Lee] Removed lock/synchronized codes because interpreterSettings already is implemented by currentHashMap 24be692 [Jongyoul Lee] Removed all synchronized blocks and replace them to read/write lock
…eterSettingManager ### What is this PR for? Removing redundant synchronized code to avoid blocking other logics. ### What type of PR is it? [Bug Fix] ### Todos * [x] - Change synchronized block to read/write lock ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3411 ### How should this be tested? * Current tests should be passed ### 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: Jongyoul Lee <jongyoul@gmail.com> Closes apache#2935 from jongyoul/ZEPPELIN-3411 and squashes the following commits: 3b90155 [Jongyoul Lee] Removed unused `import` statements Simplified `for` loop 4691301 [Jongyoul Lee] Removed lock/synchronized codes because interpreterSettings already is implemented by currentHashMap 24be692 [Jongyoul Lee] Removed all synchronized blocks and replace them to read/write lock
What is this PR for?
Removing redundant synchronized code to avoid blocking other logics.
What type of PR is it?
[Bug Fix]
Todos
What is the Jira issue?
How should this be tested?
Screenshots (if appropriate)
Questions: