-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Show message if JVM args are present but new JVM is spawned based on active modules #6476
Comments
Thanks for the suggestion, it is indeed useful. Transparently copying the first JVM parameters to the spawned JVM might work, but the main concern I have is that for large heaps sizes, a large heap is allocated for the first JVM that does nothing. So perhaps a WARN message is better. |
The other option is to do what we do with the docker setup for jetty: use start.jar with --dry-run to generate the start line that you then run directly without keeping the first JVM running. Hmmmm perhaps we should document how to do that... Something like |
@gregw The whole issue is that when using jetty provided modules it is unclear wether or not they use With Jetty 10 we now have a custom my-jvm.mod file in our docker container which contains [exec]
# static properties
systemProperty1=${ENV_VARIABLE_1}
....
# optional additions
${ENV_JAVA_OPTIONS} and then launch jetty directly using I think shipping a shell script for windows / linux with jetty could be valuable. That way the script could always use the For example |
@jnehlmeier the |
@jnehlmeier by "launch directly using If you are doing the Also, you say you are using docker, so why not use our docker-jetty images that manage doing the --dry-run when building the image rather than at start time ? or at least have a look at how they work and copy that approach. Doing as much resolution as possible at image build time is good for images that need to start quickly. We actually do have a shell script in jetty-home... but it doesn't do the |
Our jetty 9 image did not use So we had to do: # entrypoint.sh
#
# store the generated command which still contains ${ENV_VARIABLE} parameters
CMD=`java -jar start.jar --dry-run`
# apply parameter expansion so that env variables are now replaced with their content
CMD=$(eval "echo $CMD")
# start jetty
exec $CMD
Yes, but figuring out that we now need
Interesting. Yes, currently we do the
Thats true. |
Here's the docker images: https://hub.docker.com/_/jetty |
…wned * Added WARN message. * Updated documentation. * Added test case. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…wned * Updated --list-config to report whether a JVM is forked. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
…wned Updates after review: reduced the WARN message lines. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixes #6476 - Show message if JVM args are present but new JVM is spawned * Improved documentation by correctly redacting out `jetty-halt.xml`, an XML file that is only necessary for rendering the documentation. * Added WARN message when new JVM is spawned. * Updated documentation. * Updated --list-config to report whether a JVM is forked. * Added test case. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Fix #6597 Use dry run in jetty.sh Use a --dry-run in jetty.sh to pre-expand the java arguments and thus avoid having two JVMs running in the case of exec. Also made a small change to allow script to check the current directory for JETTY_BASE, as that allows testing and runs in the same style as direct calls to start.jar Signed-off-by: Greg Wilkins <gregw@webtide.com> Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
Target Jetty version(s)
10.0+
Enhancement Description
We recently upgraded to Jetty 10 and consequently used some more out-of-the-box modules that ship with jetty. One of the modules used an
[exec]
block which causes the creating of a new JVM.It would be nice if some message will be printed (info or warn) saying that a new JVM will be created. With our old configuration (Jetty 9.x) we used to start Jetty with
java $JAVA_OPTIONS -jar $JETTY_HOME/start.jar
with all kinds of java parameters in$JAVA_OPTIONS
. This stopped working with our new configuration in Jetty 10, but it wasn't immediately obvious why it stopped working.Ideally if you detect that Jetty has been launched with JVM args, e.g.
java --add-opens <module> -Xmx 2GB -jar ./start.jar
and withexec
mode being active, then log a warning that JVM parameters will not have any effect for the newly spawned JVM. Alternatively you might be able to transparently use the provided JVM args for the newly spawned JVM as well. To get the JVM args you could useManagementFactory.getRuntimeMXBean().getInputArguments()
.The text was updated successfully, but these errors were encountered: