Skip to content
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

Fixed EDT Classloading issues after EDT shutdown. #679

Merged
merged 12 commits into from
Aug 11, 2020

Conversation

Gr33nbl00d
Copy link
Contributor

The EventQueue.class stores the classloader in a final field classLoader. The EventQueue itself is stored static inside SunToolkit.class. Even if the active EDT thread classloader is modified to a JNLP classloader, classloading will fail once an AWTAutoShutdown occurs. (No edt activity for 1 second). If any new activity starts, the EDT Thread is recreated and initialized with the classloader stored in field classLoader in EventQueue class. This was not the JNLP classloader anymore. The result are ClassNotFound Exceptions. As there does not seem to be a "nice solution" because of the EventQueue implementation details the current solution temporary sets a DelegatingClassLoader to the thread which will initialize the eventqueue. Once initialized the original classloader is restored to the thread. During webstart loading the DelegatingClassLoader uses the original classloader once the jnlp classloader is active it gets injected into the DelegatingClassLoader. See:
karakun/OpenWebStart#201

The EventQueue.class stores the classloader in a final field classLoader. The EventQueue itself is stored static inside SunToolkit.class. Even if the active EDT thread classloader is modified to a JNLP classloader, classloading will fail once an AWTAutoShutdown occurs. (No edt activity for 1 second). If any new activity starts, the EDT Thread is recreated and initialized with the classloader stored in field classLoader in EventQueue class. This was not the JNLP classloader anymore. The result are ClassNotFound Exceptions. As there does not seem to be a "nice solution" because of the EventQueue implementation details the current solution temporary sets a DelegatingClassLoader to the thread which will initialize the eventqueue. Once initialized the original classloader is restored to the thread. During webstart loading the DelegatingClassLoader uses the original classloader once the jnlp classloader is active it gets injected into the DelegatingClassLoader. See:
karakun/OpenWebStart#201
@Gr33nbl00d
Copy link
Contributor Author

Implementation of DelegatingClassLoader has same overriden methods than the original implementation of DelegationClassloader:
com.sun.xml.internal.ws.client.WSServiceDelegate.DelegatingLoader

@Gr33nbl00d
Copy link
Contributor Author

As i am not so deeply into classloading, i am asking myself it this implementation is correct from security perspective. Feel free to modify

@hendrikebbers
Copy link
Member

@Gr33nbl00d great to see this PR. Thank you very much. I will try to have a look at this next week.

…legatingClassLoader.java

Co-authored-by: Hendrik Ebbers <[email protected]>
@hendrikebbers
Copy link
Member

hendrikebbers commented Jul 31, 2020

@FlorianRoettges & @Gr33nbl00d thanks for taking care of all the mentioned points in the review. I like the current state. In general I think that the given "Workaround" (let's call it lime that) is a good way for ITW / OWS to handle the general problem. I will have a deeper look and additional tests with @sclassen before we merge this PR. Hope to have time for this next week. This would make it possible to have it in the August release of ITW & OWS.

@hendrikebbers
Copy link
Member

@sclassen merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants