Uh oh!
There was an error while loading. Please reload this page.
ZEPPELIN-3411 Long running logic inside synchronized block in InterpreterSettingManager - #2935
ZEPPELIN-3411 Long running logic inside synchronized block in InterpreterSettingManager#2935jongyoul wants to merge 3 commits into
Conversation
jongyoul
commented
Apr 22, 2018
| //clean up metaInfos | ||
| intpSetting.setInfos(null); | ||
| copyDependenciesFromLocalPath(intpSetting); | ||
| intpSetting.closeInterpreters(user, noteId); |
jongyoul
commented
Apr 22, 2018
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 ? |
jongyoul
commented
Apr 22, 2018
@zjffdu Let me make it |
jongyoul
commented
Apr 23, 2018
@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? |
| */ | ||
| private final Map<String, InterpreterSetting> interpreterSettings = | ||
| Maps.newConcurrentMap(); | ||
| private final ReentrantReadWriteLock interpreterSettingsLock = new ReentrantReadWriteLock(); |
There was a problem hiding this comment.
Actually interpreterSettings is ConcurrentHashMap, I think we don't need extra lock here.
There was a problem hiding this comment.
Yes, I thought it and wanted to confirm it. Then, I'll remove all of the locks related to interpreterSettings in this class.
…s implemented by currentHashMap
jongyoul
commented
Apr 23, 2018
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.
Merge them into one line
for (InterpreterSetting intpSetting : interpreterSettings.values()) {
| import com.google.gson.Gson; | ||
| import com.google.gson.GsonBuilder; | ||
| import com.google.gson.reflect.TypeToken; | ||
| import java.util.concurrent.locks.ReentrantReadWriteLock; |
zjffdu
commented
Apr 23, 2018
THanks @jongyoul Just several minor issues, rest look good to me. |
Simplified `for` loop
jongyoul
commented
Apr 23, 2018
After finishing CI, I'll merge it |
jongyoul
commented
Apr 23, 2018
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> Closesapache#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
weand
commented
Apr 23, 2018
are you going to merge that into branch-0.8 as well? |
jongyoul
commented
Apr 23, 2018
@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> Closesapache#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> Closesapache#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> Closesapache#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: