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

"Sharing is only supported for boot loader classes because bootstrap classpath has been appended" when running with java 13 #1294

Closed
PedroHReis22 opened this issue Mar 5, 2020 · 14 comments

Comments

@PedroHReis22
Copy link

Hi, I am getting the following warning when tracing my java 13 application:

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

Even though this is just a warn, it does pollute the logs and I think would be nice to get 'fixed'.

My current stack is:

  • Java 13
  • Spring boot 2.2.5
  • dd-java-agent 0.44.0
@tylerbenson
Copy link
Contributor

What JVM startup arguments are you using?

@PedroHReis22
Copy link
Author

PedroHReis22 commented Mar 5, 2020

Hi @tylerbenson , it is -javaagent:/datadog.jar. I think it does not matter, but running over docker image openjdk:13

As this might be relevant, I am also defining the following env. variables:

DD_SERVICE_NAME
DD_TRACE_GLOBAL_TAGS
DD_AGENT_HOST
DD_INTEGRATION_KAFKA_ENABLED=false

@tylerbenson
Copy link
Contributor

ok... I wasn't sure if you had any additional JVM parameters besides the javaagent flag.

@randomanderson
Copy link
Contributor

randomanderson commented Mar 11, 2020

"Application Class-Data Sharing" is an optimization where users can record class load metadata into a "class-data archive". Launching your application again reads from this archive so that the application starts faster.

As of Java 12, OpenJDK based JDKs have a class-data archive for JDK classes. Because the Datadog agent appends to the bootstrap classpath, the class-data archive is incorrect for the system class loader.

The warning is telling you that the class data optimization is partially turned off.

The only way to get rid of the warning is to turn the optimization off fully with "-Xshare:off". However, this could potentially worsen the startup performance of your application.

@PedroHReis22
Copy link
Author

Hi @randomanderson , thanks for elaborating on this.

Would it be possible to dd-agent to somehow bypass this warning somehow? I agree that -Xshare:off works, but it seems like I have to resign the performance introduced by JDK to get rid of the warning.

I guess Application Class-Data Sharing could play an important role in serverless applications.

@NatBob
Copy link

NatBob commented Apr 28, 2020

How does one get to dd-agent and -xshare?

@randomanderson
Copy link
Contributor

@NatBob, I'm not sure what you're asking. Do you mean how to add VM arguments? It depends on how your application is started. For instance, if your commandline was:

java -jar myApplication.jar

it becomes

java -javaagent:/path/to/dd-java-agent.jar -Xshare:off -jar myApplication.jar

Different applications have different approaches. For instance, you might set JAVA_TOOL_OPTIONS or create a setEnv.sh

@randomanderson
Copy link
Contributor

@PedroHReis22 I don't think there's another way to get rid of the warning. In adding support for read only filesystems, we are reducing the amount of times we add to the bootstrap. In the future, I believe you'll only get the warning once per startup.

@lavanyayangala
Copy link

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

#can anyone help with this?

@mcculls
Copy link
Contributor

mcculls commented Oct 1, 2021

Hi @lavanyayangala - as explained in #1294 (comment) this is an informational warning which you can safely ignore, the behaviour of your application shouldn't be affected.

@yhojann-cl
Copy link

Any way for supress warning from build.gradle file or other?

@randomanderson
Copy link
Contributor

@yhojann-cl
Here is the actual code that prints this warning:

https://github.com/openjdk/jdk/blob/99ea8bf2b962011e57d02a93217d65d7259e8f80/src/hotspot/share/classfile/classLoaderExt.cpp#L61

There are 2 options to not print the warning:

  • Disable the class data optimization fully ( with -Xshare:off )
  • Disable warnings from being printed completely ( with -XX:-PrintWarnings )

As explained in #1294 (comment) , this is a warning that can be safely ignored.

@dabaus
Copy link

dabaus commented Oct 24, 2023

"Application Class-Data Sharing" is an optimization where users can record class load metadata into a "class-data archive". Launching your application again reads from this archive so that the application starts faster.

As of Java 12, OpenJDK based JDKs have a class-data archive for JDK classes. Because the Datadog agent appends to the bootstrap classpath, the class-data archive is incorrect for the system class loader.

The warning is telling you that the class data optimization is partially turned off.

The only way to get rid of the warning is to turn the optimization off fully with "-Xshare:off". However, this could potentially worsen the startup performance of your application.

What a useless warning. What where they thinking? I have this all over the place in all tools.

@va1m
Copy link

va1m commented Jan 19, 2024

I have tested several JDKs 17 and found out that only 3 of them don't show this message:

  • IBM Semeru 17.0.9
  • JetBrains Runtime 17.0.9
  • JetBrains Runtime (JCEF) 17.0.9

The JDKs have been downloaded in IDEA's "Project settings / SDKs / + / Download JDK..." tool
IBM Semeru also can be downloaded classic way, from IBM web site.

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

10 participants