Skip to content

Export fails during shutdown of the JVM with GrpcExporter #7620

@kelunik

Description

@kelunik

Describe the bug

Export fails during shutdown of the JVM.

Steps to reproduce

I'm using a auto-configured OpenTelemetrySdk instance, so shutdown should happen automatically according to the documentation. I've confirmed that by seeing a log message about multiple shutdowns if I call shutdown manually.

What did you expect to see?

No error messages logged.

What did you see instead?

Different error messages get logged, here's one of them:

ERROR io.opentelemetry.exporter.internal.grpc.GrpcExporter: Socket closed
java.net.SocketException: Socket closed
	at java.base/sun.nio.ch.NioSocketImpl.beginConnect(NioSocketImpl.java:498)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:580)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
	at java.base/java.net.Socket.connect(Socket.java:751)
	at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
	at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at io.opentelemetry.exporter.sender.okhttp.internal.RetryInterceptor.intercept(RetryInterceptor.java:96)

What version and what artifacts are you using?
Artifacts: opentelemetry-api, opentelemetry-sdk, opentelemetry-exporter-otlp, opentelemetry-sdk-extension-autoconfigure, opentelemetry-resources (2.17.1-alpha)
Version: 1.51.0
How did you reference these artifacts?

<project>
   <dependencyManagement>
      <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-bom</artifactId>
            <!-- 1.51.0 is the last version with opentelemetry-exporter-otlp depending on okhttp 4.x -->
            <version>1.51.0</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
   </dependencyManagement>
</project>
<project>
   <dependencies>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-api</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-sdk</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry.instrumentation</groupId>
         <artifactId>opentelemetry-resources</artifactId>
      </dependency>
      <dependency>
         <groupId>io.opentelemetry</groupId>
         <artifactId>opentelemetry-exporter-otlp</artifactId>
      </dependency>
   </dependencies>
</project>

Environment
Compiler: Corretto 21.0.8
OS: Linux

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

No one assigned

    Labels

    BugSomething isn't workingStaleneeds author feedbackWaiting for additional feedback from the author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions