-
Notifications
You must be signed in to change notification settings - Fork 396
Running multiple fastOptJS causes java.lang.NoClassDefFoundError: jdk/internal/reflect/MethodAccessorImpl #3921
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
Comments
* Add airframe-rx, airframe-rx-widget * Support custom style of components * Support generic attributes * Add scala.xml to support Function0, 1 binding * Handle mouse click event * Extract Twitter bootstrap-specific components * Support embedding RxElement within XML * Add RxComponent, RxElement demo * Split compile steps for Scala.js as a workaround for scala-js/scala-js#3921 * Using jsdom@10.0.0 is necessary to run tests * Add node.js fs access test (pending) * Support Scala.js 0.6.x build
Thanks for the report. If I read that stack trace right, the call to |
My guess is sbt 1.3.x's layered class loader is unloading some necessary classes before Scala.js compilation finishes. So trying sbt 1.2.x might be necessary to identify the issue. |
Possible workaround: prevent the Scala.js sbt plugin from linking two things at the same time with the following setting: Global / concurrentRestrictions += Tags.limit(ScalaJSTags.Link, 1) |
I'm assigning this to v1.0.0 until we know what is going on. My main concern is that it might invalidate the way we load the linker via reflection. |
Confirmed:
|
Created a test branch to reproduce the issue. |
Note that as of now, I cannot reproduce this locally with a trivial project:
JDK8, I will try and make the code less trivial so the |
Even with less trivial code (the reversi example) fastOpt-ing 5 projects in parallel works just fine :-/ |
I can reproduce this locally with wvlet/airframe#895. |
Seems that this is a long standing problem: "java.lang.reflect.Method invalid after 14 "invokes" tl;dr: I can reproduce this problem with my 5 project test project if I run This explains why splitting the aggregate projects works. It also explains why re-running works ( |
From the discussion you linked, it seems that it may be possible to fix/workaround the issue by delegating
|
Hmm... I really don't like this idea. It means we're opening ourselves up to having to deal with all kinds of implementation details in the An alternative is to filter the classpath we pass to the underlying |
Not isolating GCC and Guava would be annihilate most of the benefits of our class loading approach for users, leaving them only with the disadvantages. That's not an option. |
I can confirm that adding |
Direct reference to the JDK bug |
@vjovanov have you ever heard of this? |
@gzm0 Nice catch!
Thank you for finding that. It makes a lot of sense about this consistent behavior. |
Added a fix in #3928 |
I'll comment here (instead of #3928) so everything is in the same thread. I'd like to clarify the severity of the mess I have created with this classloader thing.
As a result, I'd like us to consider the consequences on really committing to this setup and consider alternatives thoroughly. Since in theory, this means That in turn means that I'm very uncomfortable releasing 1.0.0 with merely having a workaround for this issue (I'm OK with a workaround if we know a way to fix it in a compatible manner and/or are OK with accepting the current state). |
I don't understand why this is such an issue. It happens sometimes that an upgrade in a dependency causes unintentional breakages (or intentional breakages that affect us in a way we thought unexpected), and we have to deal with it. Scala itself sometimes has to publish new versions following upgrades of the JDK (e.g., the issue that required us to have this workaround for a while)). It's also worth pointing out that adding |
Another way to look at it is that adding In that, the current comment in the PR is misleading I think. It should first foremost say that it is a workaround for that OpenJDK bug, then only reference the present issue for context. |
Does it? Then maybe I'm misunderstanding what is happening here. If this is the case, of course a workaround like #3928 is perfectly acceptable. I don't have time right now, but I'd like to slice down what exactly is happening here (which classloader is doing what, etc.). If it turns out, we are in spec, then yes, the workaround is fine. |
After some thinking, I think @sjrd is correct. This is a clearly a JDK bug only and not Scala.js abusing an implementation detail. Notably, my previous depiction of the situation is wrong: There is no coupling between dependencies of dependencies, only on direct dependencies (i.e. Let's make an example and take two (direct "module") dependencies of
Case 2 is as intended and "recurses" into the Case 1 is a bit more subtle and splits in two cases itself: The loaded dependency does not have any dependencies itself on the loading dependency (i.e. However, if the loaded dependency "reverse depends" on the loading dependency ( Concluding, if a class matching While this is theoretically possible out of our control, IMHO it is highly unlikely and hence acceptable. Coming back to this specific case here, I presume the implementation of |
Oh, I forgot: @sjrd does the last comment match your understanding of the situation? |
Yes, that matches my understanding as well, with a more detailed analysis that what I had done :) |
Actually, case 2 of the private dependency is only correct when it tries to load non-provided dependencies (i.e. stuff it declares in its POM). So technically we'd need to add all packages in the JDK to the |
Oh, I just hit his while re-engineering my build file under 1.0.0-RC2. sjrd's fix for cuncurrentRestrictions did not fix it for me. I had been just compiling projects one at a time during upgrade testing. Is there another workaround? I have 25 scala.js projects in one build. I've tried various jdks with no luck. |
As an interesting sidenote, I have another unrelated project that references several of those projects via a sbt ProjectRef and it works fine when cleaning and compiling everything in that unrelated project (which cleans and rebuilds almost everything in the project with many scala.js projects). |
You can probably work around the issue by invoking sbt with
You can use a higher number of necessary. With 25 projects, anything above 25 should be fine. |
That works. |
Fix #3921: Work around JDK-6265952: MethodAccessorImpl NoClassDefError
Fixed in a2ee859 |
Uh oh!
There was an error while loading. Please reload this page.
Symptom:
It might be an issue of sbt-scalajs plugin and sbt-1.3.x's new classloader.(The same problem happens with sbt 1.2.8) I'll work on reproduction of this issue.It seems the reflection call of PathOutputFile in the LinkerImpl is failing:
This is used here:
A workaround is splitting an aggregated project into a smaller set of projects and running fastOptJS individually.
The text was updated successfully, but these errors were encountered: