-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
HttpClientConnection error after some Idle time when triggering a chatInputInteractionEventhandler that sends a response #1038
Comments
Hi, even though Reactor Netty will attempt to check the connection health and even retry connection reset errors once, it can be possible that a network component (firewall, router, etc) is closing the connection due to inactivity. You could experiment with customizing the connection pool DiscordClient.builder(token)
.setReactorResources(ReactorResources.builder()
.httpClient(ReactorResources.newHttpClient(ConnectionProvider.builder("custom")
.maxIdleTime(Duration.ofMinutes(10))
.build()))
.build())
.build()
.login()
.block(); Can also be done globally using a system property: https://projectreactor.io/docs/netty/snapshot/reference/index.html#_connection_pool Please let us know if this helps |
Hi thanks for the hint! I'll tweek the settings and check back on you in the next few days. |
Hi, i had the same problem with problematic internet connection (bad IPv6 NAT). My solution was to always create a new connection lie this:
|
Retrying at the D4J client level can also work (context). For epoll: DiscordClient client = DiscordClient.builder(token)
.onClientResponse(
ResponseFunction.retryWhen(
RouteMatcher.any(),
Retry.anyOf(Errors.NativeIoException.class)))
.build(); For nio: DiscordClient client = DiscordClient.builder(token)
.onClientResponse(
ResponseFunction.retryWhen(
RouteMatcher.any(),
Retry.anyOf(IOException.class)))
.build(); after |
Hello.
Context:
I'm currently working on simple discord4j bot that tracks the time we spend on our gaming server.
To display statistics I've created an application command and a respective ChatInputInteractionEvent listener to handle input and answer with some data packed into an embed.
To Reproduce:
Send a application command to message channel after some IDLE time.
Expected Behavior:
The server handles the message create event and is able to send a response.
Actual Behavior:
When the server was running in idle for about 15 minutes, triggering an message create event results in an exception on server side that the HTTP connection has been closed. When resending a message directly afterwards it works.
Is there a way to check if the connection is still available before processing the event's response, or activate some sort of self-fix?
The exact exception that occurrs is the following:
On client side the interaction looks like this:
I've experienced a similar problem when using MessageCreateEvent and text commands.
Version:
discord4j 3.2.0
Other:
I'm using discord4j version 3.2.0 and running in a v2.5.6 spring boot application using java 11.
Thanks in advance and sorry if this is just a "user"bug 👀. Please contact me if you need more information.
greetings suizi
The text was updated successfully, but these errors were encountered: