'Intermitent "Received RST_STREAM: Not an error" observed when calling send on java.net.http.HttpClient

I've noticed recently a weird, intermittent error: "Received RST_STREAM: Not an error" which seems to come from java when calling send on java.net.http.HttpClient. Googling it, I found similar errors but not exactly with the same message.

Any idea what is causing this error? Is there a way to work around it? Or a Java patch will be required?

Thanks.

I'm currently on:

openjdk version "15" 2020-09-15
OpenJDK Runtime Environment Zulu15.27+17-CA (build 15+36)
OpenJDK 64-Bit Server VM Zulu15.27+17-CA (build 15+36, mixed mode, sharing)

The complete error stack is:

{
    "timeMillis": 1647842673682,
    "thread": "process-task-thread",
    "level": "ERROR",
    "loggerName": "com.bla.core.env.data.collector.services.KafkaService",",
    "thrown": {
        "commonElementCount": 0,
        "localizedMessage": "Received RST_STREAM: Not an error",
        "message": "Received RST_STREAM: Not an error",
        "name": "java.io.IOException",
        "cause": {
            "commonElementCount": 0,
            "localizedMessage": "Received RST_STREAM: Not an error",
            "message": "Received RST_STREAM: Not an error",
            "name": "java.io.IOException",
            "extendedStackTrace": [{
                    "class": "jdk.internal.net.http.Stream",
                    "method": "handleReset",
                    "file": "Stream.java",
                    "line": 496,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Stream",
                    "method": "schedule",
                    "file": "Stream.java",
                    "line": 177,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SynchronizedRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 175,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 147,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SchedulableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 198,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 271,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 224,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Stream",
                    "method": "receiveResetFrame",
                    "file": "Stream.java",
                    "line": 338,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Stream",
                    "method": "incoming_reset",
                    "file": "Stream.java",
                    "line": 474,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Stream",
                    "method": "otherFrame",
                    "file": "Stream.java",
                    "line": 410,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Stream",
                    "method": "incoming",
                    "file": "Stream.java",
                    "line": 400,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection",
                    "method": "processFrame",
                    "file": "Http2Connection.java",
                    "line": 801,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.frame.FramesDecoder",
                    "method": "decode",
                    "file": "FramesDecoder.java",
                    "line": 155,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection$FramesController",
                    "method": "processReceivedData",
                    "file": "Http2Connection.java",
                    "line": 232,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection",
                    "method": "asyncReceive",
                    "file": "Http2Connection.java",
                    "line": 663,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection$Http2TubeSubscriber",
                    "method": "processQueue",
                    "file": "Http2Connection.java",
                    "line": 1289,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SynchronizedRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 175,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 147,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SchedulableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 198,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 271,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 224,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection$Http2TubeSubscriber",
                    "method": "runOrSchedule",
                    "file": "Http2Connection.java",
                    "line": 1307,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection$Http2TubeSubscriber",
                    "method": "onNext",
                    "file": "Http2Connection.java",
                    "line": 1333,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.Http2Connection$Http2TubeSubscriber",
                    "method": "onNext",
                    "file": "Http2Connection.java",
                    "line": 1267,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SSLTube$DelegateWrapper",
                    "method": "onNext",
                    "file": "SSLTube.java",
                    "line": 210,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SSLTube$SSLSubscriberWrapper",
                    "method": "onNext",
                    "file": "SSLTube.java",
                    "line": 492,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SSLTube$SSLSubscriberWrapper",
                    "method": "onNext",
                    "file": "SSLTube.java",
                    "line": 295,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SubscriberWrapper$DownstreamPusher",
                    "method": "run1",
                    "file": "SubscriberWrapper.java",
                    "line": 316,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SubscriberWrapper$DownstreamPusher",
                    "method": "run",
                    "file": "SubscriberWrapper.java",
                    "line": 259,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SynchronizedRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 175,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 147,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SchedulableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 198,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 271,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler",
                    "method": "runOrSchedule",
                    "file": "SequentialScheduler.java",
                    "line": 224,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SubscriberWrapper",
                    "method": "outgoing",
                    "file": "SubscriberWrapper.java",
                    "line": 232,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SubscriberWrapper",
                    "method": "outgoing",
                    "file": "SubscriberWrapper.java",
                    "line": 198,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SSLFlowDelegate$Reader",
                    "method": "processData",
                    "file": "SSLFlowDelegate.java",
                    "line": 444,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher",
                    "method": "run",
                    "file": "SSLFlowDelegate.java",
                    "line": 268,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SynchronizedRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 175,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 147,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "jdk.internal.net.http.common.SequentialScheduler$SchedulableTask",
                    "method": "run",
                    "file": "SequentialScheduler.java",
                    "line": 198,
                    "exact": false,
                    "location": "java.net.http",
                    "version": "?"
                }, {
                    "class": "java.util.concurrent.ThreadPoolExecutor",
                    "method": "runWorker",
                    "file": "ThreadPoolExecutor.java",
                    "line": 1130,
                    "exact": false,
                    "location": "?",
                    "version": "?"
                }, {
                    "class": "java.util.concurrent.ThreadPoolExecutor$Worker",
                    "method": "run",
                    "file": "ThreadPoolExecutor.java",
                    "line": 630,
                    "exact": false,
                    "location": "?",
                    "version": "?"
                }, {
                    "class": "java.lang.Thread",
                    "method": "run",
                    "file": "Thread.java",
                    "line": 832,
                    "exact": false,
                    "location": "?",
                    "version": "?"
                }
            ]
        },
        "extendedStackTrace": [{
                "class": "jdk.internal.net.http.HttpClientImpl",
                "method": "send",
                "file": "HttpClientImpl.java",
                "line": 564,
                "exact": false,
                "location": "java.net.http",
                "version": "?"
            }, {
                "class": "jdk.internal.net.http.HttpClientFacade",
                "method": "send",
                "file": "HttpClientFacade.java",
                "line": 119,
                "exact": false,
                "location": "java.net.http",
                "version": "?"
            }, {
                "class": "com.bla.core.client.CoreHttpClient",
                "method": "callHttpEndpointWithRetry",
                "file": "CoreHttpClient.java",
                "line": 80,
                "exact": false,
                "location": "env-kafka-client-1.0.25.jar!/",
                "version": "?"
            }, {
                "class": "com.bla.core.client.CoreHttpClient",
                "method": "callHttpService",
                "file": "CoreHttpClient.java",
                "line": 71,
                "exact": false,
                "location": "env-kafka-client-1.0.25.jar!/",
                "version": "?"
            }, {
                "class": "com.bla.core.client.kafka.http.KafkaClient",
                "method": "fetchDataWithRetry",
                "file": "KafkaClient.java",
                "line": 329,
                "exact": false,
                "location": "env-kafka-client-1.0.25.jar!/",
                "version": "?"
            }, {
                "class": "com.bla.core.client.kafka.http.KafkaClient",
                "method": "fetchDataAsString",
                "file": "KafkaClient.java",
                "line": 222,
                "exact": false,
                "location": "env-kafka-client-1.0.25.jar!/",
                "version": "?"
            }, {
                "class": "com.bla.core.client.kafka.http.KafkaClient",
                "method": "fetchDataAsObject",
                "file": "KafkaClient.java",
                "line": 235,
                "exact": false,
                "location": "env-kafka-client-1.0.25.jar!/",
                "version": "?"
            }, {
                "class": "com.bla.core.env.data.collector.services.KafkaService",
                "method": "processTask",
                "file": "KafkaService.java",
                "line": 313,
                "exact": true,
                "location": "classes!/",
                "version": "?"
            }, {
                "class": "com.bla.core.env.data.collector.services.KafkaService$1",
                "method": "run",
                "file": "KafkaService.java",
                "line": 191,
                "exact": true,
                "location": "classes!/",
                "version": "?"
            }
        ]
    },
    "endOfBatch": false,
    "loggerFqcn": "org.apache.logging.slf4j.Log4jLogger",
    "threadId": 406797,
    "threadPriority": 5,
    "threadId": "354a358c-a233-476b-a9d1-fcb4adf7ac00--1647842642705"
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source