On 10/07/2024 16:37, Jaroslav Bachorik wrote:
:

This may not always be possible. Some systems have rather complex and inlexible launchers - for example Apache Spark with its clusters, drivers and executors and automatic distribution of resources. For that system, if one needs to add an on-startup Java agent via `-javaagent` option the only way is to modify the setup which will add `-javaagent` to all components, pointing to a location where the resource distribution service should be putting the agent jar. However, mistakes happen and the jar may not be there. But because usually the agent is providing tracing or metrics collection, which are all optional, it is not feasible to hard-crash the Java process because of not being able to load the Java agent.

Forn this PoV the proposal to allow optionally ignoring non-existing Java agent sounds as a very pragmatic solution,


The issue of injecting CLI options to start tool agents was explored back in JSR 163, that is the reason for environment variables such as JAVA_TOOL_OPTIONS. Broader support was added in JDK 9 with JDK_JAVA_OPTIONS, @argfile support, and support for GNU style options. So the JDK has several features to augment the command line or options.

Has anyone tried to work with the Apache Spark (or other projects) to make use of any of this support so that additional CLI options are conditionally used?

-Alan

Reply via email to