question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] divide plugin webclient throw exception: The connection observed an error,io.netty.handler.timeout.ReadTimeoutException: null

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

2021-11-04 10:58:29 [XNIO-1 I/O-3] INFO org.apache.shenyu.plugin.httpclient.WebClientPlugin - The request urlPath is /api/v1/query?query=rate%28recv_packet_total%7Bsource%21%3D%22cffex%22%2Ctarget%3D~%22cffex.%2A%22%7D%5B5m%5D

%29&time=2021-11-04T02%3A58%3A28.564680692Z, retryTimes is 3 2021-11-04 10:58:32 [reactor-http-epoll-3] WARN reactor.netty.http.client.HttpClientConnect - [id: 0xa0255f85, L:/10.201.220.93:34256 - R:product.thanos.10jqka.com.cn/172.20.208.115:80] The connection observed an error io.netty.handler.timeout.ReadTimeoutException: null 2021-11-04 10:58:32 [reactor-http-epoll-3] ERROR org.apache.shenyu.plugin.httpclient.WebClientPlugin - null io.netty.handler.timeout.ReadTimeoutException: null 2021-11-04 10:58:32 [reactor-http-epoll-3] ERROR org.apache.shenyu.web.handler.GlobalErrorHandler - [e9ba400] Resolved [ReadTimeoutException: null] for HTTP GET /prometheus/api/v1/query 2021-11-04 10:58:32 [reactor-http-epoll-3] ERROR org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler - [e9ba400] 500 Server Errorfor HTTP GET "/prometheus/api/v1/query?query=rate

%28recv_packet_total%7Bsource%21%3D%22cffex%22%2Ctarget%3D~%22cffex.%2A%22%7D%5B5m%5D%29&time=2021-11-04T02%3A58%3A28.564680692Z" io.netty.handler.timeout.ReadTimeoutException: null 2021-11-04 10:58:32 [reactor-http-epoll-3] ERROR reactor.core.publisher.Operators - Operator called default onErrorDropped java.lang.NullPointerException: null 2021-11-04 10:58:32 [reactor-http-epoll-3] WARN io.netty.channel.AbstractChannelHandlerContext - An exception ‘reactor.core.Exceptions$BubblingException: java.lang.NullPointerException’ [enable DEBUG level for full stacktrace] was

thrown by a user handler’s exceptionCaught() method while handling the following exception: io.netty.handler.timeout.ReadTimeoutException: null 10:58:39,277 |-INFO in ReconfigureOnChangeTask(born:1634129949276) - Empty watch file list. Disabling

Expected Behavior

No response

Steps To Reproduce

No response

Environment

ShenYu version(s):2.4.0

Debug logs

No response

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Rubenmpcommented, Jul 8, 2022

Just in case it helps.

I had the same error in a personal project and I was able to solve it. I was using webClient (‘org.springframework.boot:spring-boot-starter-webflux:2.7.1’) for async calls and getting this annoying errors polluting stderr:

14:39:38.128 [reactor-http-nio-4] ERROR r.n.http.client.HttpClientConnect - [id: 0x05f49b52, L::60850 - R:] The connection observed an error
io.netty.handler.timeout.ReadTimeoutException: null

This code was throwing the errors:

return webClient.get().uri(url).retrieve().bodyToFlux(String.class)
        .timeout(timeout); // <---- The problem is here, it is throwing ReadTimeoutException logging the error.

It is possible to manually solve the error for each timeout, in the code it is done with:

.timeout(duration, Mono.error(new TimeoutException("Response took longer than timeout: " + duration)))

Adding this line to the application.properties file(s) will prevent all these logs by default (we can log the exception with flux methods like onErrorContinue, …):

logging.level.reactor.netty.http.client.HttpClient=OFF

I have searched in this project and there are several timeouts: timeoouts-in-project I think that this issue can be solved by checking all the usages of WebClient and timeouts and/or disabling netty logs.

See the pull request.

0reactions
dragon-zhangcommented, Aug 4, 2022

@dongxl123 @MarsOu1995 @haitun521 Please try the latest code, and if there are still questions, please submit a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] divide plugin webclient throw exception: The ... - GitHub
[BUG] divide plugin webclient throw exception: The connection observed an error,io.netty.handler.timeout.ReadTimeoutException: null #2303.
Read more >
Facing io.netty.handler.timeout.ReadTimeoutException
The connection observed an error io.netty.handler.timeout.ReadTimeoutException: null reactor.Flux.MonoFlatMapMany.1 onError(org.springframework.
Read more >
io.netty.handler.timeout.ReadTimeoutException Java Examples
This page shows Java code examples of io.netty.handler.timeout. ... null) { if (cause instanceof ReadTimeoutException) { logger.error("{}: read timed out", ...
Read more >
reactor/reactor - Gitter
The connection observed an error 2019-03-26T18:45:46.05-0400 [APP/PROC/WEB/0] OUT io.netty.handler.timeout.ReadTimeoutException: null ...
Read more >
Set a Timeout in Spring 5 Webflux WebClient - Baeldung
In this example, we configure the timeout for 1 second. Netty doesn't set the response timeout by default. After that, we can supply...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found