-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
JVM hangs after request completion #3144
Comments
OkHttp, the HTTP client which sits behind Retrofit by default, uses non-daemon threads. This will prevent the JVM from exiting until they time out. The general pattern for avoiding this scenario is: client.dispatcher.executorService.shutdown()
client.connectionPool.evictAll() where |
Thanks for the tip, that worked like a charm! |
Cheers @JakeWharton This is exactly what I was looking for as well. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Versions
I created a new Kotlin project and tried to use Retrofit, but it seems to hang the JVM after the
main
function completes for no apparent reason. I've created a minimal repro in this repo:All three
println
statements execute, but then the JVM doesn't immediately finish gracefully. It continues to run for a few minutes, eventually exiting with code 0, but much longer than it should. Is this just an issue on my machine? Am I just doing something incorrect here?The text was updated successfully, but these errors were encountered: