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

Bnd fails to launch Bndruns for JDK 8 with Unrecognized option #3869

Closed
amitjoy opened this issue Apr 3, 2020 · 11 comments
Closed

Bnd fails to launch Bndruns for JDK 8 with Unrecognized option #3869

amitjoy opened this issue Apr 3, 2020 · 11 comments
Assignees
Milestone

Comments

@amitjoy
Copy link
Member

amitjoy commented Apr 3, 2020

Something noticeable I found in the latest Bndtools Snapshot Version (5.1.0.DEV-202004021913-gd8d520f). Unfortunately I cannot run any of the Bndrun files.

Unrecognized option: -ea -XX:StringTableSize=60013 -XX:+HeapDumpOnOutOfMemoryError -XX:+ExitOnOutOfMemoryError -XX:HeapDumpPath=./var/osgi/jvm/heapdumps -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx256M -Xms20M -Xss256K -XX:+UnlockCommercialFeatures -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -XX:+FlightRecorder -XX:FlightRecorderOptions="loglevel=info,defaultrecording=true,disk=true,repository=./var/osgi/jvm/flightrecorder/,dumponexit=true,dumponexitpath=./var/osgi/jvm/flightrecorder/"
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

It worked perfectly till yesterday. I switched back to Bndtools 5.0.1.REL to see if the problem is something not relevant to Bndtools. And luckily it works in the latest release version. I believe that any of the latest changes might have caused this.

@bjhargrave
Copy link
Member

bjhargrave commented Apr 3, 2020

Can you please provide the Eclipse launch and bndrun files you are using?

42277d5 changed how Bndtools formats the vm and program args for Eclipse launching.

@bjhargrave bjhargrave self-assigned this Apr 3, 2020
@bjhargrave
Copy link
Member

A small github repo which demonstrates the problem would be best.

@amitjoy
Copy link
Member Author

amitjoy commented Apr 3, 2020

Sure. I would try to prepare an example project and send you the link.

@pkriens
Copy link
Member

pkriens commented Apr 3, 2020

This happened after the change you made yesterday, so maybe you can look if something can cause this?

@bjhargrave
Copy link
Member

This happened after the change you made yesterday, so maybe you can look if something can cause this?

I assume the issue results from the change I made. So I would like the launch/bndrun info to confirm.

@amitjoy
Copy link
Member Author

amitjoy commented Apr 3, 2020

@bjhargrave I believe it would be easier for you if I can just provide you with the bndrun that cannot be launched. The enclosed bndrun comprises only the necessary VM arguments that you can include in any of your existing bndrun files. Then you don't have to checkout my example project and test separately.

I had to rename the file since GitHub doesn't allow adding files having bndrun extensions 😉
vm.txt

@bjhargrave bjhargrave added this to the 5.1 milestone Apr 3, 2020
@bjhargrave
Copy link
Member

Well the big problem here is that -runvm is a comma separated list of items. See https://bnd.bndtools.org/chapters/300-launching.html.

But you are using SPACE separated options. This basically worked before because Bnd treated is as one option and passed it to the Eclipse launcher which parsed it by the spaces.

The recent change to Bnd to better handle options with spaces in them means that Bnd will process EACH -runvm option and quote it if it has a space. Since your bndrun file effectively has only a single -runvm option with spaces, we kindly quoted it. And the vm chokes on the very long option which it does not understand.

So you do need to use commas to separate options on your -runvm value. You are not alone in this mistake. It turns out we, the Bnd team, have made the same mistake in our own bndrun files. For example:

-runvm: -XstartOnFirstThread -Djava.awt.headless=true -Dorg.eclipse.swt.internal.carbon.smallFonts ${crossplatform.vmargs} -ea

(which I will fix shortly).

Once you fix your -runvm to use comma separators, it should work fine.

@amitjoy
Copy link
Member Author

amitjoy commented Apr 6, 2020

Thanks @bjhargrave. It works perfectly now. 👍

@shinych
Copy link

shinych commented Jul 25, 2020

@bjhargrave how do I escape the comma now if I want to have it in the value of a program argument? Thanks

@shinych
Copy link

shinych commented Jul 25, 2020

@bjhargrave
Copy link
Member

how do I escape the comma now if I want to have it in the value of a program argument?

See

-runvm: -XX:+UnlockCommercialFeatures, -XX:+FlightRecorder, "-XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true"
for an example of quoting an argument containing commas.

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

4 participants