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
Force immediate shutdown #1141
Comments
A few things to consider here:
|
Well, it's obvious that an immediate shutdown is really immediate, so queued RestActions won't get executed and people have to count on it.
If this is a bug, then it's a really old one, as there were few releases which didn't fix it (yet?). But i agree with other points. |
The same applies to JDA. I have known about this behavior for months if not years and decided not to change our handling. I intentionally did not add any special shutdown behavior for this and I don't intend to do. |
May i please know why? |
I consider this bad behavior and a bug in okhttp that we should not need to workaround. I try not to implement workarounds if possible. And in this case its definitely not needed as the thread times out either way. |
Just throwing in my two cents but I would like a blocking shutdown method that only returns once pending RestActions have completed, after that I don't really care about the okhtttp connection pool and could just exit manually. Even with http 1.1 the okhttp still seems to take 1 minute to shut down (considerably better than 5 minutes with http 2 but still). |
I mean, the method as |
I think adding a section in the troubleshooting page of the wiki where the issue and workarounds are explained and a corresponding tag for the Discord servers Spectra bot would be a good option to consider in the case that no changes to JDAs code are made. |
From my experience, most people figure out how to use
I think that is reasonable. |
I have added an entry for this in the troubleshooting guide: Shutdown but the process doesn't exit |
I consider this as a reason to close this issue. Thanks for your time. |
General Troubleshooting
Feature Request
So, i asked about this "feature" (more like an addition or fix if you wish) in the JDA guild already and i was advised to rather create an issue instead of creating a PR, so here it is. I saw many people having "issue" with JDA not shutting down immediately even when using
shutdownNow()
method. This could be fixed by using two methods provided in the http client.Example Use-Case
These are the methods that could result in an immediate shutdown.
Those methods could be implemented in 2 ways.
shutdownNow()
methodshutdownForcely()
, which would callshutdownNow()
and those 2 methodsExample
shutdownNow()
shutdownForcely()
(?)Calling such methods would make JDA completely unusable for further use, obviously.
The text was updated successfully, but these errors were encountered: