Skip to content

http-url-connection instrumentation fails with read-only filesystem on Java 25Β #17030

@kchrusciel

Description

@kchrusciel

Describe the bug

When running on Java 25 in an environment with a read-only filesystem (e.g. Kubernetes with readOnlyRootFilesystem: true), the http-url-connection instrumentation fails at startup with:

ERROR io.opentelemetry.javaagent.tooling.HelperInjector - Error preparing helpers while processing class sun.net.www.protocol.http.HttpURLConnection for http-url-connection. Failed to inject helper classes into instance <bootstrap>
java.lang.IllegalStateException: Failed to create temporary directory.
	at io.opentelemetry.javaagent.tooling.HelperInjector.createTempDir(HelperInjector.java:432)
	at io.opentelemetry.javaagent.tooling.HelperInjector.injectBootstrapClassLoader(HelperInjector.java:416)
...
Caused by: java.nio.file.FileSystemException: /tmp/opentelemetry-temp-jars5955764542960470820: Read-only file system

Steps to reproduce

  1. Run any Java 25 application with the OTel Java agent (tested with v2.25.0)
  2. Use a Kubernetes pod with readOnlyRootFilesystem: true and no writable /tmp volume
  3. Application makes an HTTPS connection via HttpURLConnection

Expected behavior

No error at startup. The http-url-connection instrumentation should work on Java 25 without requiring a writable /tmp, the same way java-util-logging was fixed in #15682.

Actual behavior

Errors at startup

Javaagent or library instrumentation version

2.25.0

Environment

JDK: 25
OS: Linux

Additional context

On Java 25, Unsafe is no longer available for defining classes in the bootstrap classloader. HelperInjector falls back to Instrumentation.appendToBootstrapClassLoaderSearch, which requires creating a temporary JAR in /tmp.
PR #15682 solved this for java-util-logging by introducing JulLookupSupplier and registering it via addPackageLookup() in HelperInjector. The same approach is needed for http-url-connection.

Currently registered LookupSuppliers in HelperInjector:

http-url-connection has no equivalent supplier, so it always falls back to the /tmp path on Java 25.

Environment

  • OTel Java agent version: v2.25.0
  • Java version: 25
  • OS: Linux (Kubernetes, readOnlyRootFilesystem: true)

Related

Tip

React with πŸ‘ to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds triageNew issue that requires triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions