-
Notifications
You must be signed in to change notification settings - Fork 116
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
[Java 21] "Setting Security Manager is not supported" errors #709
[Java 21] "Setting Security Manager is not supported" errors #709
Comments
Platform is currently Java 17 so why is this a bug? What has changed since last discussion here? Any new decisions? |
Java 21 (next LTS) was released |
So Platform will upgrade to Java 21 for the 2023-12 release? That would be great 👍 |
No, for sure not, but people / organisations will start Java 21 evaluation & migration and we should make sure that we don't ship software that report errors "by default". E.g. in Advantest we monitor error log during test executions and report every unexpected warning/error as test fail. So switching our build to Java 21 would lead to test errors in all places where ant could be involved. Of course we can suppress that specific error in tests, but our customers, once we switch product to run on Java 21, will see the errors and report bugs. That all shouldn't happen if we know where the problem is, so a generic (not client specific) solution is needed. |
The default Eclipse Packages use Java 17 as a JVM so no errors are reported, this was discussed already here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=575210 so for me the question is what "bug" in Platform is here to solve? This is the corresponding bug/issue at ANT: https://bz.apache.org/bugzilla/show_bug.cgi?id=65381 So from platform side Java 21+ Ant is currently not supported and Platform is targeting Java 17 right now and also ships with this JVM. |
I see it from user side, and it is clearly a bug if software reports errors. |
Our code would have to be changed to version guard and not set SecurityManager if running on Java 21+. |
I as a user don't see the error ...
Depends on how one defines "solve" ... you won't see the error anymore but Ant can now kill your eclipse, similar to this m2e issue:
The solution is to use the JVM we recommend, test and ship to the user :-) |
Please note that Eclipse platform is not only an IDE - it's an RCP platform used in very different environments, requirements and etc. thus there is no way that "one size fits all" works. |
The Eclipse project does not ship the JVM (EPPs do). We should work (and test) on the latest Java LTS release. |
I wonder, does |
It depends how you define "works" :-) With the argument above Eclipse crashes reporting on the shell this:
But using allow like here Does this mean, we should add this argument to the eclipse ini as solution but only if we detect Java 21+ runtime? Or are there better alternatives? |
Given we only support Java 17+ we could set that by default in eclipse.ini. That should work for Java 17 also. |
Google turned up wrong answer. You can't trust anything anymore. 😱 Yes, as @tjwatson suggests, this has been working for quite some time. I believe in ant 1.10.13 they defined such a class to make it work with older JVMs, but that's removed in 1.10.14 (and that caused problems BND problems). Let's hold off any decisions until we see how 1.0.14 works. Maybe they didn't something super smart? |
Depends on the point of view :-) If AI's final goal is the death of mankind, the first step is to give seemingly right answers leading to crashes. Next time it will be not an IDE but some missile launch engineer copy/pasting AI's proposal :-( |
The next I-Build will be based on ant 1.10.14. This page still suggestion Temurin 21 should arrive this month: |
I see same errors reported with I20230924-0600 (without
Eclipse says it is using |
From ant 1.10.14 whatsnew file:
|
OK, so "Setting Security Manager is not supported" error is not reported by actual ant code, it is our own error? |
Yes, it is Line 68 in efe0dce
|
Yes, we need to update out Ant code. As Ant is not supporting the setting of SecurityManager any more. The change with Ant 1.10.14 is that Ant is not adding any "allow" class any more. |
I just wanted to add that I came across a very neat solution (described by @bmarwell) for this (@tjwatson maybe this would be an option for Equinox / OSGi as well):
As a result, your jar will use the SM when running on JVM < 21 and will not use it when running on JVM >= 21 🥇 |
Oh hey @tjwatson again 👋🏻😅 Here's the needed setup: Alternative: parse the output of a static initialiser block of the system property "java.version". |
FYI, Setting |
Thanks @bmarwell.
The framework has no need for this and I would not be for this existing in the framework. What is the stacktrace of what is setting the security manager? If it is coming from Ant then I doubt we would convince Ant to make calls to some org.eclipse API to work around it. If it is coming from the framework itself then it is a bug we must fix in the framework, but I doubt that would involve some complicated MR JAR solution. |
Ha, I thought it is already clear where the message originated. The other option, if you find a perfectly valid MR Jar complicated, is a static initialiser loading one of two classes (one which does the SM logic, one which doesn't) However, you will instead need to parse the Java version for this. Not sure MR Jar is more complicated than parsing Java versions, but YMMV. As this might need a backport, you probably cannot use Java 11's Runtime.getVersion(). |
This looks for me as the best proposal so far. I've played a bit with current platform & I don't see any issues with this preference on Java 21 / latest ant. Example project with the ant build file/launch config that runs System.exit() from ant running from IDE: The output looks like:
I would propose a PR adding this system property in platform SDK product and open an issue on https://github.com/eclipse-packaging/packages/issues to add FYI: we set security manager in two places, to run ant / resolve ant build files, see https://github.com/search?q=%28org%3Aeclipse-platform+setSecurityManager%29+&type=code |
This avoids "Setting Security Manager is not supported" errors logged if running ant related tooling on Java 21. Fixes eclipse-platform/eclipse.platform#709
I've created eclipse-packaging/packages#71 for epp. |
For the completeness: there is a Java bug asking to provide a replacement API that would disallow |
Isn't there an |
No idea. |
No, each EPP product specifies such things itself. E.g., |
This avoids "Setting Security Manager is not supported" errors logged if running ant related tooling on Java 21. Fixes eclipse-platform/eclipse.platform#709
There used to be, but EPP no longer uses Platform's product as starting point due to limitations in the p2 model that meant we had duplicate entries for |
I don't think |
Sorry - I was imprecise with the wording. I was trying to provide historical context from when Platform did used to provide =11.
IIUC requiredJavaVersion will raise an error if JVM is < than requiredJavaVersion. If not specified, the bundles with BREE > than JVM will simply not be used. Therefore I think we need requiredJavaVersion to be the minimum version so we don't surprise users. |
Yes it is supposed to cause an explicit failure on startup even before bundles fail to start. |
The security manager is needed if ant is installed (either pre-installed or added by the user). This change synchronizes all the EPP packages with the change made to Eclipse Platform/SDK products in eclipse-platform/eclipse.platform#709 This also addresses the "Synchronize any changes to platform.product into all the epp.product files." step from RELEASING.md Fixes eclipse-packaging#71 Part of eclipse-packaging#72
After starting I20230921-0530 on Java 21 I see following errors reported in the log:
We should do something on Java 21 to avoid that code being executed or at least mute the error if we can't avoid that.
The text was updated successfully, but these errors were encountered: