influxdata / influxdata/influxdb-client-java
java.io.InterruptedIOException: interrupted is thrown and I don't know why.
- Vorherrschende Sprache
- Java
- Sterne
- 477
- Forks
- 129
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
__Steps to reproduce:__
I am facing an unexpected exception: `java.io.InterruptedIOException: interrupted` . We have 180,000 invoke everyday, 10+ of these will meet `java.io.InterruptedIOException: interrupted`.
Here is my code:
```java
@Service
public class InfluxdbServiceImpl implements InfluxdbService {
protected final String bucket;
protected final String org;
protected InfluxDBClient client;
protected WriteApi writeApi;
public InfluxdbServiceImpl(IotInfluxdbProperties iotInfluxdbProperties) {
if (StringUtils.hasText(iotInfluxdbProperties.getToken()) &&
StringUtils.hasText(iotInfluxdbProperties.getUrl()) &&
StringUtils.hasText(iotInfluxdbProperties.getBucket()) &&
StringUtils.hasText(iotInfluxdbProperties.getOrg())) {
client = InfluxDBClientFactory.create(iotInfluxdbProperties.getUrl(),
iotInfluxdbProperties.getToken().toCharArray());
writeApi = client.makeWriteApi();
this.bucket = iotInfluxdbProperties.getBucket();
this.org = iotInfluxdbProperties.getOrg();
} else {
throw new IllegalArgumentException("Argument is empty:" + iotInfluxdbProperties);
}
}
@Override
public boolean insert(List points) {
writeApi.writePoints(bucket, org, points);
return true;
}
}
```
Here is stacktrace:
```
java.io.InterruptedIOException: interrupted
at okio.Timeout.throwIfReached(Timeout.kt:98)
at okio.OutputStreamSink.write(JvmOkio.kt:50)
at okio.AsyncTimeout$sink$1.write(AsyncTimeout.kt:103)
at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
at okio.RealBufferedSink.write(RealBufferedSink.kt:146)
at okhttp3.internal.http1.Http1ExchangeCodec$KnownLengthSink.write(Http1ExchangeCodec.kt:271)
at okio.ForwardingSink.write(ForwardingSink.kt:29)
at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.kt:218)
at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.kt:255)
at okio.RealBufferedSink.write(RealBufferedSink.kt:185)
at okhttp3.RequestBody$Companion$toRequestBody$2.writeTo(RequestBody.kt:152)
at retrofit2.RequestBuilder$ContentTypeOverridingRequestBody.writeTo(RequestBuilder.java:292)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:59)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
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 com.influxdb.client.internal.GzipInterceptor.intercept(GzipInterceptor.java:91)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:152)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at com.influxdb.client.internal.AuthenticateInterceptor.intercept(AuthenticateInterceptor.java:103)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at com.influxdb.internal.UserAgentInterceptor.intercept(UserAgentInterceptor.java:60)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.sw$original$getResponseWithInterceptorChain$okhttp$lito5p0(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.sw$original$getResponseWithInterceptorChain$okhttp$lito5p0$accessor$sw$qmhb7m1(RealCall.kt)
at okhttp3.internal.connection.RealCall$sw$auxiliary$vnmot80.call(Unknown Source)
at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt)
at okhttp3.internal.connection.RealCall.sw$original$execute$b3g7a40(RealCall.kt:154)
at okhttp3.internal.connection.RealCall.sw$original$execute$b3g7a40$accessor$sw$qmhb7m1(RealCall.kt)
at okhttp3.internal.connection.RealCall$sw$auxiliary$0c49e42.call(Unknown Source)
at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:204)
at retrofit2.adapter.rxjava3.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:46)
at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13173)
at io.reactivex.rxjava3.internal.operators.observable.ObservableSingleSingle.subscribeActual(ObservableSingleSingle.java:36)
at io.reactivex.rxjava3.core.Single.subscribe(Single.java:4855)
at io.reactivex.rxjava3.internal.operators.maybe.MaybeFromSingle.subscribeActual(MaybeFromSingle.java:41)
at io.reactivex.rxjava3.core.Maybe.subscribe(Maybe.java:5375)
at io.reactivex.rxjava3.internal.operators.maybe.MaybeMap.subscribeActual(MaybeMap.java:41)
```
I have read `Timeout.kt` try to find out why this exception is thrown.
```
@Throws(IOException::class)
open fun throwIfReached() {
if (Thread.interrupted()) {
Thread.currentThread().interrupt() // Retain interrupted status.
throw InterruptedIOException("interrupted")
}
if (hasDeadline && deadlineNanoTime - System.nanoTime() <= 0) {
throw InterruptedIOException("deadline reached")
}
}
```
The code indicate that the exception is thrown when thread is interrupted. My code is very simple and do not interrupt any thread.
BTW, as you can see in stack trace ,we are using Skywalking as monitor client. each failed invoking only takes 1 or 2ms .
__Expected behavior:__
I hope the client tell me the reason more specifically.
__Specifications:__
- Client Version: 6.7.0
- InfluxDB Version: 2.6.1
- JDK Version: 11
- Platform: linux
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start at the writeApi.writePoints entry point and follow the request path shown in the stack trace, beginning with Okio's Timeout.kt and the client's GzipInterceptor. Reproduce the interruption with the listed client, JDK, and SkyWalking setup, then determine what context the client can report so the failure reason is more specific.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100