Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 205990

Summary: [launcher] Invalid JVM options are silently ignored
Product: [Eclipse Project] Equinox Reporter: Daniel Serodio <eclipse.dserodio>
Component: LauncherAssignee: Project Inbox <equinox.launcher-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, jevon, Jim.Adams, mober.at+eclipse, psolanki, Silenio_Quarti, tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Daniel Serodio CLA 2007-10-10 18:18:16 EDT
In Eclipse 3.2, if you had an invalid option in eclipse.ini or in the command-line, Eclipse would refuse to start, and would show a "JVM exited with error code 1" dialog, so I knew something was wrong.
A plain "java" command also refuses to start if given an invalid option, and shows which option is invalid.

Now, in Eclipse 3.3, an invalid option is silently ignored, so I don't know I messed up!

Because of bug 203325, I added a "-XXMaxPermSize=256m" (note the missing colon) option to my eclipse.ini, and strugled for days wondering why my Eclipse 3.3.1 JEE instalation kept crashing, in spite of the MaxPermSize option.
Thanks to Andrew Niefer at the equinox newsgroup I was able to launch Eclipse with the "old" launcher (launching the JVM in a separate process), and finally fix my problem.

Invalid options shouldn't be silently ignored.
Comment 1 Thomas Watson CLA 2007-10-11 09:25:01 EDT
If we had known invalid arguments got ignored when jni launching then we could have just added the -XX:MaxPermSize=256m and done away with the --launcher.XXMaxPermSize option for the Sun VM.

When using the -vm option in the eclipse.ini to point to the java exe the invalid arguments do prevent the launch.  I assume something about launching the vm with jni in process is allowing the invalid arguments to be ignored.  The Sun and IBM VMs both seem to ignore invalid options when launched this way.
Comment 2 Andrew Niefer CLA 2007-10-11 10:19:56 EDT
When creating the vm we set JavaVMInitArgs.ignoreUnrecognized = true.  We do this mostly because it seemed like a good idea at the time.  It is trivial to change if we want to.

I could be wrong, but I am not 100% confident that this is respected by all vms on all platforms. 

 If we were confident of this, --launcher.XXMaxPermSize could mean set -XX:MaxPermSize when launching via JNI or when we know it is Sun.  (Though this is moot if we decide to set ignoreUnrecognized=false).

We can't just specify the -XX:MaxPermSize and have it ignored because we don't know that we are always launching via jni.  Some platforms (linux.ppc, aix) still have problems with JNI launching and default to using the exe.  Sometimes we can just fail to find the jvm shared library and fall back on the exe.  Or the user could just specify the exe with -vm.
Comment 3 Andrew Niefer CLA 2007-10-17 12:12:27 EDT
ignoreUnrecognized was set to false in I20071016-1215.  This is working fine on all platforms tested except for the Mac.

On Mac the vm is failing to start so ignoreUnrecognized has be reset back to true for the Mac and this bug remains open until we can figure out what the problem is on the mac.
Comment 4 Daniel Serodio CLA 2007-10-17 12:46:04 EDT
Don't you just love "write once, run anywhere" ? :-)
Comment 5 Andrew Niefer CLA 2007-10-18 11:36:53 EDT
bug 206614 comment #4 implies the problem on the mac is the -Xdock:icon argument.

This together with changes made in bug 173764 suggests to me that -Xdock:icon (and -Xdock:name) is not an actual vm argument, but rather an argument that is processed and removed by the mac java launcher.  Which means that the eclipse launcher should consume the -Xdock:icon when it sets the corresponding APP_ICON_%d environment variable.

Silenio, can you comment on this?
Comment 6 Silenio Quarti CLA 2007-10-18 18:08:06 EDT
I believe you are right. You need to handle -Xdock:name as well.
Comment 7 Andrew Niefer CLA 2007-11-05 10:57:14 EST
I think we should reconsider if we really want to do this.
We are heading down the path where every argument consumed by any supported java vm's launcher now needs to be consumed by the eclipse launcher.

I can see more bugs like bug 208671 coming up and needing changes.
Comment 8 Thomas Watson CLA 2007-11-05 11:22:49 EST
This is a catch 22.  On one hand we would like to know when there is an argument the java launcher is consuming because we would like to mimic the behavior if possible.  On the other hand it will force use to know about and possibly support all arguments consumed by any supported java vm's launcher.

Is there an option to ignore loudly? ;)  Meaning allow the vm to load but print (ideally log) an error message?
Comment 9 Andrew Niefer CLA 2007-11-12 14:42:59 EST
I have reverted this for now and we are once again ignoring unrecognized options.
I will investigate logging or printing a message if the vm will tell us it didn't recognize the argument.  Otherwise, I think a option to turn this on or off is in order.
Comment 10 Martin Oberhuber CLA 2010-05-06 08:53:02 EDT
To me, it seems that knowing about unrecognized VM options is something that's relevant to product builders, commandline users or power users. As an end user, I don't necessarily want to know whether my VM just silently swallowed an option.

Perhaps a --launcher.noJNI option as suggested in bug 188616, along with appropriate documentation that this is good during development / testing but not for deployment, might be an acceptable mitigation in the short term. Since that would force using the java.exe and thus also enable messages about unrecognized vmargs.

Or, an explicit switch for enabling/disabling messages about unrecognized vmargs.
Comment 11 Eclipse Genie CLA 2018-11-25 14:20:26 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 12 Lars Vogel CLA 2019-09-04 01:52:59 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.