elastic / apm-agent-android

Elastic APM Android Agent
Apache License 2.0
21 stars 6 forks source link

NetworkService.java:87 crash on 0.13.0 #254

Closed julia-je closed 10 months ago

julia-je commented 10 months ago

On v 0.13.0 still getting a crash, relates to this fix: https://github.com/elastic/apm-agent-android/pull/244/files/ae2911c10907fd808b7b0978642e69cf9a77dbc4

I believe canQueryCarrierInfo check should be run on the same instance of sim operator data instead of requesting it in 2 places.


Caused by java.lang.StringIndexOutOfBoundsException: length=0; index=3
       at java.lang.String.substring(String.java:1971)
       at co.elastic.apm.android.sdk.internal.services.network.NetworkService.getCarrierInfo(NetworkService.java:87)
       at co.elastic.apm.android.sdk.attributes.common.CarrierHttpAttributesVisitor.visit(CarrierHttpAttributesVisitor.java:39)
       at co.elastic.apm.android.sdk.attributes.impl.ComposeAttributesVisitor.visit(ComposeAttributesVisitor.java:36)
       at co.elastic.apm.android.sdk.attributes.impl.VisitorAttributesCreator.create(VisitorAttributesCreator.java:36)
       at co.elastic.apm.android.sdk.internal.opentelemetry.processors.spans.ElasticSpanProcessor.onStart(ElasticSpanProcessor.java:51)
       at io.opentelemetry.sdk.trace.SdkSpan.startSpan(SdkSpan.java:197)
       at io.opentelemetry.sdk.trace.SdkSpanBuilder.startSpan(SdkSpanBuilder.java:219)
       at co.elastic.apm.android.sdk.traces.http.impl.okhttp.OtelOkHttpEventListener.createWrapperSpan(OtelOkHttpEventListener.java:112)
       at co.elastic.apm.android.sdk.traces.http.impl.okhttp.OtelOkHttpEventListener.callStart(OtelOkHttpEventListener.java:85)
       at java.lang.reflect.Method.invoke(Method.java)
       at co.elastic.apm.android.common.okhttp.eventlistener.CompositeEventListener.doCall(CompositeEventListener.java:41)
       at co.elastic.apm.android.common.okhttp.eventlistener.Generated_CompositeEventListener.callStart(:20)
       at okhttp3.internal.connection.RealCall.callStart(RealCall.kt:171)
       at okhttp3.internal.connection.RealCall.enqueue(RealCall.kt:163)
       at okhttp3.internal.ws.RealWebSocket.connect(RealWebSocket.kt:165)
       at okhttp3.OkHttpClient.newWebSocket(OkHttpClient.kt:281)
       at io.socket.engineio.client.transports.WebSocket.doOpen(WebSocket.java:52)
       at io.socket.engineio.client.Transport$1.run(Transport.java:76)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.engineio.client.Transport.open(Transport.java:71)
       at io.socket.engineio.client.Socket$2.run(Socket.java:264)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.engineio.client.Socket.open(Socket.java:242)
       at io.socket.client.Manager$1.run(Manager.java:310)
       at io.socket.thread.EventThread.exec(EventThread.java:55)
       at io.socket.client.Manager.open(Manager.java:222)
       at io.socket.client.Manager$7$1.run(Manager.java:510)
       at io.socket.thread.EventThread$2.run(EventThread.java:80)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764) ]
LikeTheSalad commented 10 months ago

Hi @julia-je Thank you for raising this issue, I'm on it.

LikeTheSalad commented 10 months ago

We just released version 0.13.1 which includes these changes to fix it. Feel free to reopen this issue if the problem persists with the new version.

Thank you.