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

Encapsulated StreamResetException as IllegalStateException unhandled by the SDK #6946

Open
celikrecep opened this issue Dec 12, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@celikrecep
Copy link

Hello, I am using the OpenTelemetry-Java SDK in an Android application. I am encountering a StreamResetException error. Normally, when an exception is thrown from requests made within the app, we catch these exceptions, but these network errors do not seem to fall into the same handling mechanism. I did not encounter this issue while using version 1.40.0, but I started experiencing it after upgrading to version 1.44.0. I found a similar issue for a different error, and I wanted to share it with you as I think it might be related. Since the stack trace did not point to any specific part of the project, I felt it necessary to open an issue. Could you please assist me with this? I am open to any suggestions.

Fatal Exception: java.lang.IllegalStateException
okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:609)
java.util.HashMap.forEach (HashMap.java:1432)
io.opentelemetry.sdk.internal.AttributesMap.forEach (AttributesMap.java)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:536)
io.opentelemetry.exporter.internal.otlp.traces.SpanEventStatelessMarshaler.writeTo (SpanEventStatelessMarshaler.java:29)
io.opentelemetry.exporter.internal.otlp.traces.SpanEventStatelessMarshaler.writeTo (SpanEventStatelessMarshaler.java:19)
io.opentelemetry.exporter.internal.marshal.ProtoSerializer.serializeRepeatedMessageWithContext (ProtoSerializer.java:239)
io.opentelemetry.exporter.internal.otlp.traces.SpanStatelessMarshaler.writeTo (SpanStatelessMarshaler.java:53)
io.opentelemetry.exporter.internal.otlp.traces.SpanStatelessMarshaler.writeTo (SpanStatelessMarshaler.java:22)
io.opentelemetry.exporter.internal.marshal.ProtoSerializer.serializeRepeatedMessageWithContext (ProtoSerializer.java:239)
io.opentelemetry.exporter.internal.otlp.traces.InstrumentationScopeSpansStatelessMarshaler.writeTo (InstrumentationScopeSpansStatelessMarshaler.java:39)
io.opentelemetry.exporter.internal.otlp.traces.InstrumentationScopeSpansStatelessMarshaler.writeTo (InstrumentationScopeSpansStatelessMarshaler.java:21)
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:606)
java.util.IdentityHashMap.forEach (IdentityHashMap.java:1354)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:513)
io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansStatelessMarshaler.writeTo (ResourceSpansStatelessMarshaler.java:46)
io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansStatelessMarshaler.writeTo (ResourceSpansStatelessMarshaler.java:28)
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:606)
java.util.IdentityHashMap.forEach (IdentityHashMap.java:1354)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:513)
io.opentelemetry.exporter.internal.otlp.traces.LowAllocationTraceRequestMarshaler.writeTo (LowAllocationTraceRequestMarshaler.java:73)
io.opentelemetry.exporter.internal.marshal.Marshaler.writeBinaryTo (Marshaler.java:23)
io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSender$RawRequestBody.writeTo (OkHttpHttpSender.java:213)
okhttp3.internal.http.CallServerInterceptor.intercept (CallServerInterceptor.kt:62)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
fsimpl.bD.intercept (Unknown Source:14)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:34)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
io.opentelemetry.exporter.sender.okhttp.internal.RetryInterceptor.intercept (RetryInterceptor.java:91)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
fsimpl.bD.intercept (Unknown Source:14)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
okhttp3.internal.connection.RealCall$AsyncCall.run (RealCall.kt:517)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
java.lang.Thread.run (Thread.java:1012)
Caused by okhttp3.internal.http2.StreamResetException
stream was reset: CANCEL
okhttp3.internal.http2.Http2Stream.checkOutNotClosed$okhttp (Http2Stream.kt:646)
okhttp3.internal.http2.Http2Stream$FramingSink.emitFrame (Http2Stream.kt:557)
okhttp3.internal.http2.Http2Stream$FramingSink.write (Http2Stream.kt:532)
okio.ForwardingSink.write (ForwardingSink.kt:29)
okhttp3.internal.connection.Exchange$RequestBodySink.write (Exchange.kt:223)
okio.RealBufferedSink.emitCompleteSegments (RealBufferedSink.kt:256)
okio.RealBufferedSink$outputStream$1.write (RealBufferedSink.kt:118)
io.opentelemetry.exporter.internal.marshal.CodedOutputStream$OutputStreamEncoder.doFlush (CodedOutputStream.java:632)
io.opentelemetry.exporter.internal.marshal.CodedOutputStream$OutputStreamEncoder.write (CodedOutputStream.java:544)
io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.encodeUtf8 (StatelessMarshalerUtil.java:455)
io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.writeUtf8 (StatelessMarshalerUtil.java:442)
io.opentelemetry.exporter.internal.marshal.StatelessMarshalerUtil.writeUtf8 (StatelessMarshalerUtil.java:426)
io.opentelemetry.exporter.internal.marshal.ProtoSerializer.writeString (ProtoSerializer.java:163)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeStringWithContext (Serializer.java:235)
io.opentelemetry.exporter.internal.otlp.StringAnyValueStatelessMarshaler.writeTo (StringAnyValueStatelessMarshaler.java:29)
io.opentelemetry.exporter.internal.otlp.AttributeKeyValueStatelessMarshaler$ValueStatelessMarshaler.writeTo (AttributeKeyValueStatelessMarshaler.java:117)
io.opentelemetry.exporter.internal.otlp.AttributeKeyValueStatelessMarshaler$ValueStatelessMarshaler.writeTo (AttributeKeyValueStatelessMarshaler.java:71)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeMessageWithContext (Serializer.java:311)
io.opentelemetry.exporter.internal.otlp.AttributeKeyValueStatelessMarshaler.writeTo (AttributeKeyValueStatelessMarshaler.java:47)
io.opentelemetry.exporter.internal.otlp.AttributeKeyValueStatelessMarshaler.writeTo (AttributeKeyValueStatelessMarshaler.java:27)
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:606)
java.util.HashMap.forEach (HashMap.java:1432)
io.opentelemetry.sdk.internal.AttributesMap.forEach (AttributesMap.java)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:536)
io.opentelemetry.exporter.internal.otlp.traces.SpanEventStatelessMarshaler.writeTo (SpanEventStatelessMarshaler.java:29)
io.opentelemetry.exporter.internal.otlp.traces.SpanEventStatelessMarshaler.writeTo (SpanEventStatelessMarshaler.java:19)
io.opentelemetry.exporter.internal.marshal.ProtoSerializer.serializeRepeatedMessageWithContext (ProtoSerializer.java:239)
io.opentelemetry.exporter.internal.otlp.traces.SpanStatelessMarshaler.writeTo (SpanStatelessMarshaler.java:53)
io.opentelemetry.exporter.internal.otlp.traces.SpanStatelessMarshaler.writeTo (SpanStatelessMarshaler.java:22)
io.opentelemetry.exporter.internal.marshal.ProtoSerializer.serializeRepeatedMessageWithContext (ProtoSerializer.java:239)
io.opentelemetry.exporter.internal.otlp.traces.InstrumentationScopeSpansStatelessMarshaler.writeTo (InstrumentationScopeSpansStatelessMarshaler.java:39)
io.opentelemetry.exporter.internal.otlp.traces.InstrumentationScopeSpansStatelessMarshaler.writeTo (InstrumentationScopeSpansStatelessMarshaler.java:21)
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:606)
java.util.IdentityHashMap.forEach (IdentityHashMap.java:1354)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:513)
io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansStatelessMarshaler.writeTo (ResourceSpansStatelessMarshaler.java:46)
io.opentelemetry.exporter.internal.otlp.traces.ResourceSpansStatelessMarshaler.writeTo (ResourceSpansStatelessMarshaler.java:28)
io.opentelemetry.exporter.internal.marshal.Serializer$RepeatedElementPairWriter.accept (Serializer.java:606)
java.util.IdentityHashMap.forEach (IdentityHashMap.java:1354)
io.opentelemetry.exporter.internal.marshal.Serializer.serializeRepeatedMessageWithContext (Serializer.java:513)
io.opentelemetry.exporter.internal.otlp.traces.LowAllocationTraceRequestMarshaler.writeTo (LowAllocationTraceRequestMarshaler.java:73)
io.opentelemetry.exporter.internal.marshal.Marshaler.writeBinaryTo (Marshaler.java:23)
io.opentelemetry.exporter.sender.okhttp.internal.OkHttpHttpSender$RawRequestBody.writeTo (OkHttpHttpSender.java:213)
okhttp3.internal.http.CallServerInterceptor.intercept (CallServerInterceptor.kt:62)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
fsimpl.bD.intercept (Unknown Source:14)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:34)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
io.opentelemetry.exporter.sender.okhttp.internal.RetryInterceptor.intercept (RetryInterceptor.java:91)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
fsimpl.bD.intercept (Unknown Source:14)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
okhttp3.internal.connection.RealCall$AsyncCall.run (RealCall.kt:517)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:644)
java.lang.Thread.run (Thread.java:1012)
```

**What did you expect to see?**
I was expecting the SDK not to throw an exception

**What did you see instead?**
it throws an exception.

**What version and what artifacts are you using?**
Artifacts: (`opentelemetry-bom`, `opentelemetry-sdk`, `opentelemetry-api`, `opentelemetry-exporter-otlp`, `opentelemetry-exporter-logging`, `opentelemetry-exporter-otlp-common`)

Version: (`1.44.0`)

How did you reference these artifacts? 
`build.gradle`

**Environment**
OS: (Android)

@celikrecep celikrecep added the Bug Something isn't working label Dec 12, 2024
@jack-berg
Copy link
Member

fsimpl.bD.intercept (Unknown Source:14)

Hi @celikrecep any idea where this stack trace is coming from? Its not part of opentelemetry-java or from the okhttp library we use as an HTTP client.

Also, can you share some of the logs surrounding that stack trace? My current read of the source code leads me to believe that this exception occurred but could be a normal / expected part of transmitting data with unreliable networks. The additional logs could indicate what happened as a result of this exception. My best guess based on the source code is that an attempt to export spans failed, and this exception stack trace is just explaining why.

@celikrecep
Copy link
Author

@jack-berg

fsimpl.bD.intercept (Unknown Source:14)

appears to originate from the FullStory SDK. You can find their documentation here: FullStory Android SDK. It’s worth noting that FullStory has been integrated into our app for a long time; it was not recently added. Unfortunately, we don’t have any additional logs besides the ones I’ve already shared from Firebase. Based on the events we’ve sent, I can infer that users are encountering this crash randomly while navigating through the app. There doesn’t seem to be any specific pattern to it. Could it be related to the version? As I mentioned, we didn’t encounter this issue before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants