-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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
- Run any Java 25 application with the OTel Java agent (tested with v2.25.0)
- Use a Kubernetes pod with readOnlyRootFilesystem: true and no writable /tmp volume
- 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:
- ExecutorLookupSupplier
- JulLookupSupplier β added by Allow defining jul helper classes without using temp directoryΒ #15682
- LambdaLookupSupplier
- ReflectionLookupSupplier
- VirtualFieldLookupSupplier
- AdviceForwardLookupSupplier
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
- Issue Errors at startup in read-only filesystems environmentΒ #15666 β original report for read-only filesystem errors
- PR Allow defining jul helper classes without using temp directoryΒ #15682 β fix for java-util-logging, same approach needed here
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.