Navigation Menu

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

Race conditions in Define Class under Java 11 #242

Open
michalkurka opened this issue Jan 25, 2019 · 3 comments
Open

Race conditions in Define Class under Java 11 #242

michalkurka opened this issue Jan 25, 2019 · 3 comments

Comments

@michalkurka
Copy link
Contributor

We encountered exceptions in our tests when javassist is used in a multi-threaded environment:

01-24 17:22:59.044 127.0.0.1:44006       23858  FJ-3-55   ERRR: java.lang.RuntimeException: javassist.CannotCompileException: by java.lang.IllegalAccessException: class javassist.util.proxy.DefineClassHelper$JavaOther cannot access a member of class java.lang.ClassLoader (in module java.base) with modifiers "protected final"

Occurs rarely and only on Java 11. PR demonstrating the issue and a proposed fix will be submitted shortly.

@michalkurka
Copy link
Contributor Author

Please see PR for details #243

@chibash
Copy link
Member

chibash commented Jan 27, 2019

I've merged the PR.
By the way, your code seems to use the old API. Java 11 requires us to use Lookup object
when loading a class file. Use ProxyFactory#createClass(Lookup).
The Lookup object can be obtained by calling MethodHandles.lookup() from somewhere
in the package that the proxy class belongs to.

@MastaP
Copy link

MastaP commented Feb 13, 2019

FYI, this concurrency issue is also reproducible on Java 6 (yes ZT still needs javassist to work with 6).
We did exactly same fix in Dec but did not have a chance to create a PR.
zeroturnaround@20de6b2

odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 10, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 17, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a404f1)
odl-github pushed a commit to opendaylight/odlparent that referenced this issue Oct 17, 2019
3.25 fixes:
- jboss-javassist/javassist#72
- jboss-javassist/javassist#241
- jboss-javassist/javassist#242
- jboss-javassist/javassist#246
- jboss-javassist/javassist#252
3.26 fixes:
- jboss-javassist/javassist#265
- jboss-javassist/javassist#270
- jboss-javassist/javassist#271
- jboss-javassist/javassist#275

Of these #270 is most important, as it fixes an issue we've seen
with powermock downstream.

Change-Id: Ib4d75d6411e71438436249a8eb9313ccf4411ca2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6a404f1)
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

No branches or pull requests

3 participants