-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[ZEPPELIN-1972] Preserve context classloader #1911
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
Conversation
IMain.interpret changes current thread's context classloader. It's a scala bug. As a workaround we need to save and restore context classloader manually
|
LGMT. I have a question. Is there any related issue to SparkInterpreter? Can you take a look into it? |
|
@jongyoul I checked SparkInterpreter, it has the same issue with context class loader |
|
Thanks @DrIgor for fix and explanation of the issue! When RemoteInterpreterServer creates Interpreter, it wraps interpreter instance with LazyOpenInterpreter. If we wrap interpreter instance with ClassLoaderInterpreter as well, like zeppelin do when creating interpreter locally, then every interpreter will benefit by ClassloaderInterpreter. ClassloaderInterpreter restores classloader after methods call. @DrIgor @jongyoul Shell we try make RemoteInterpreterServer wrap interpreter with ClassloaderInterpreter? what do you think? |
|
@Leemoonsoo I think to wrap it with |
|
@Leemoonsoo @jongyoul thank you! I didn't know about ClassLoaderInterpreter Unfortunately, our tests don't use InterpreterFactory and will use unwrapped Interpreter instance. So It won't fix flaky test. Besides, code inside interpreter itself will use incorrect classloader. Currently it isn't an issue but someday... Maybe It's better to wrap IMain or create "scala utils" to share common code between several scala-speaking interpreters? |
|
It actually wrap and conserve classloader for interpreter. I think you just change this line https://github.com/apache/zeppelin/blob/master/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java#L192 to use |
|
Concerning |
|
Yes, I tried ClassloaderInterpreter but it didn't fix original issue. https://github.com/apache/zeppelin/blob/master/ignite/src/test/java/org/apache/zeppelin/ignite/IgniteInterpreterTest.java#L69 So we need wrap every IgniteInterpreter usage. Besides, wrapper restores classloader after interpreter call and interpreter itself use broken classloader. |
|
Got it. How about wrapping it like |
|
Is there any update on it? |
|
I tried to wrap with But I don't like this solution. We force every user of It looks like dirty fix for me. If you think that wrapper is more appropriate I will update PR |
|
@DrIgor I agree with you. It's very easily broken. But on the other hands, I will make a new PR for changing LGTM, will merge it. |
### What is this PR for? `IMain.interpret` changes current thread's context classloader. It may cause different issues and definitely is the reason of [ZEPPELIN-1738](https://issues.apache.org/jira/browse/ZEPPELIN-1738) test failures. It's a known scala bug. See https://issues.scala-lang.org/browse/SI-9587 As a workaround we need to save and restore context classloader manually ### What type of PR is it? Bug Fix ### What is the Jira issue? [ZEPPELIN-1972](https://issues.apache.org/jira/browse/ZEPPELIN-1972) ### How should this be tested? Run ignite interpreter test and ignite sql interpreter test in the same thread ``` mvn test -pl ignite -am -Pscala-2.11 -Dtest=org.apache.zeppelin.ignite.IgniteInterpreterTest#testInterpret,org.apache.zeppelin.ignite.IgniteSqlInterpreterTest#testSql -DfailIfNoTests=false ``` ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Igor Drozdov <[email protected]> Closes #1911 from DrIgor/ZEPPELIN-1972 and squashes the following commits: 35c5abd [Igor Drozdov] Preserve context classloader (cherry picked from commit 859d175) Signed-off-by: Jongyoul Lee <[email protected]>
### What is this PR for? `IMain.interpret` changes current thread's context classloader. It may cause different issues and definitely is the reason of [ZEPPELIN-1738](https://issues.apache.org/jira/browse/ZEPPELIN-1738) test failures. It's a known scala bug. See https://issues.scala-lang.org/browse/SI-9587 As a workaround we need to save and restore context classloader manually ### What type of PR is it? Bug Fix ### What is the Jira issue? [ZEPPELIN-1972](https://issues.apache.org/jira/browse/ZEPPELIN-1972) ### How should this be tested? Run ignite interpreter test and ignite sql interpreter test in the same thread ``` mvn test -pl ignite -am -Pscala-2.11 -Dtest=org.apache.zeppelin.ignite.IgniteInterpreterTest#testInterpret,org.apache.zeppelin.ignite.IgniteSqlInterpreterTest#testSql -DfailIfNoTests=false ``` ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Igor Drozdov <[email protected]> Closes apache#1911 from DrIgor/ZEPPELIN-1972 and squashes the following commits: 35c5abd [Igor Drozdov] Preserve context classloader (cherry picked from commit 859d175)
### What is this PR for? `IMain.interpret` changes current thread's context classloader. It may cause different issues and definitely is the reason of [ZEPPELIN-1738](https://issues.apache.org/jira/browse/ZEPPELIN-1738) test failures. It's a known scala bug. See https://issues.scala-lang.org/browse/SI-9587 As a workaround we need to save and restore context classloader manually ### What type of PR is it? Bug Fix ### What is the Jira issue? [ZEPPELIN-1972](https://issues.apache.org/jira/browse/ZEPPELIN-1972) ### How should this be tested? Run ignite interpreter test and ignite sql interpreter test in the same thread ``` mvn test -pl ignite -am -Pscala-2.11 -Dtest=org.apache.zeppelin.ignite.IgniteInterpreterTest#testInterpret,org.apache.zeppelin.ignite.IgniteSqlInterpreterTest#testSql -DfailIfNoTests=false ``` ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Igor Drozdov <[email protected]> Closes apache#1911 from DrIgor/ZEPPELIN-1972 and squashes the following commits: 35c5abd [Igor Drozdov] Preserve context classloader (cherry picked from commit 859d175) Signed-off-by: Jongyoul Lee <[email protected]> (cherry picked from commit 4ca89d1)
### What is this PR for? Fix CI build failure on branch-0.6. ### What type of PR is it? Hot Fix ### Todos - Modified [.travis.yml](https://github.com/apache/zeppelin/blob/branch-0.6/.travis.yml) according to #1774 - Merged PR #1920 #1911 - Update spark version and hadoop version in [.travis.yml](https://github.com/apache/zeppelin/blob/branch-0.6/.travis.yml) since older spark version below 1.6.2 can not be downloaded from remote server any more. ### What is the Jira issue? No related Jira issue ### How should this be tested? See if CI becomes green ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No Author: Igor Drozdov <[email protected]> Author: Lee moon soo <[email protected]> Author: z0621 <[email protected]> Closes #2262 from hammertank/HOTFIX and squashes the following commits: 380432c [z0621] [HOTFIX] Fix CI build failure on branch-0.6 f1c8041 [Igor Drozdov] [ZEPPELIN-1972] Preserve context classloader 4ae3adb [Lee moon soo] [ZEPPELIN-1455] Fix flaky test: AbstractAngularElemTest
What is this PR for?
IMain.interpretchanges current thread's context classloader. It may cause different issues and definitely is the reason of ZEPPELIN-1738 test failures.It's a known scala bug. See https://issues.scala-lang.org/browse/SI-9587
As a workaround we need to save and restore context classloader manually
What type of PR is it?
Bug Fix
What is the Jira issue?
ZEPPELIN-1972
How should this be tested?
Run ignite interpreter test and ignite sql interpreter test in the same thread
Questions: