On Mon, Jul 8, 2024 at 11:19 AM Alan Bateman <alan.bate...@oracle.com> wrote:
> On 03/07/2024 11:26, Thiago Henrique Hupner wrote: > > Dear JDK developers, > > > > I'd like to propose adding an option that allows the JVM to ignore a > > non-existent -javaagent instead of aborting. > > > > Currently, if a -javaagent is specified but the agent jar file doesn't > > exist, the JVM aborts with an error. This can cause issues in > > environments where the same JVM arguments are used across different > > systems, but not all systems have the agent installed. > > In general you can't assume that the same VM options or arguments to the > java launcher can be used across different systems, different JDK > releases, or in this case specifying a tool agent that may not be > installed or may be installed in a different location. For this case it > may be better to re-visit the launch script for the application so that > it conditionally adds the -javaagent option when the tool agent is needed. > 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, -JB- > > -Alan >