java.io.IOException: Canceled
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:72)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at org.stellar.sdk.requests.ClientIdentificationInterceptor.intercept(ClientIdentificationInterceptor.java:22)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
...
Here is the root cause:
When reconnectTimeout expires, restart is called
eventSource.cancel() is triggered.
The previously canceled StellarEventSourceListener (the one that we don't track) can receive the IOException (Canceled) because the call was canceled in okhttp. The origin of the exception is here.
I suggest the SSEStream to not fire the onFailure() to the listener if the exception was targeting the canceled StellarEventSourceListener.
I encountered an unpredictable and unwanted exception thrown from the SSEStream of the Java Horizon SDK (https://github.com/lightsail-network/java-stellar-sdk).
Here is the root cause:
When
reconnectTimeout
expires, restart is called eventSource.cancel() is triggered.A new
StellarEventSourceListener
is created for the new event source.The previously canceled
StellarEventSourceListener
(the one that we don't track) can receive theIOException (Canceled)
because the call was canceled in okhttp. The origin of the exception is here.I suggest the
SSEStream
to not fire theonFailure()
to the listener if the exception was targeting the canceledStellarEventSourceListener
.