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

java.io.InterruptedIOException: interrupted is thrown and I don't know why. #793

Open
OrezzerO opened this issue Dec 23, 2024 · 0 comments

Comments

@OrezzerO
Copy link

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:

@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<Point> 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant