Don't add debug config if it's already present #274
Labels
hacktoberfest
Hacktoberfest eligible
note:good-first-issue
A good first issue to get started with
note:ideal-for-contribution
An issue that a contributor can help us with
type:bug
A general bug
Expected Behavior
Current Behavior
Steps to Reproduce
If you set
JAVA_TOOL_OPTIONS
to contain Java debug info, like-agentlib:jdwp=transport=dt_socket,server=y,address=%s,suspend=%s
and then setBPL_DEBUG_ENABLED=true
. You'll end up with debug setting specified twice and the JVM will fail to start. The buildpack helper should not add them if it already exists.Possible Solution
The buildpack will need to look at
JAVA_TOOL_OPTIONS
and do a fuzzy search for-agentlib:jdwp=transport=dt_socket,server=y,address=%s,suspend=%s
. Possibly by looking for an arg that starts with-agentlib:jdwp
. If present, log a message and indicate that it was not added a second time. If not present, add it.This needs to be fixed in both Java 8 & Java 9+ helpers.
Motivations
This can also impact cases where you use one process type through
/cnb/process/*
to invoke a process type contributed by a libjvm powered buildpack. In this case, the launcher will run twice and can cause the JVM agent properties to be added multiple times.The text was updated successfully, but these errors were encountered: