-
Notifications
You must be signed in to change notification settings - Fork 660
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
Query execute prevents process from finishing in 3.0.0 beta 04 #3619
Comments
One thing that comes to mind is the OkHttp threadpools. Can you try passing an explicit OkHttpClient and releasing it as in https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/#shutdown-isnt-necessary val okHttpClient = OkHttpClient.builder().build()
val apolloClient = ApolloClient.Builder()
.serverUrl("https://www.google.com")
.okHttpClient(okHttpClient)
.build()
// do things...
// when done
apolloClient.dispose()
okHttpClient.dispatcher().executorService().shutdown();
okHttpClient.connectionPool().evictAll();
|
Thanks for the fast reply @martinbonnin . I even tested with Apollo Android 2.5.11 and it seems to be the same thing there. |
Yep, this rings a bell. Let me try quickly |
Nope, all seems to work here. Can you check https://github.com/martinbonnin/termination-test/tree/main and see if you can make it hang ? |
Really strange. Your example is exiting properly. Will have to check what's different compared to my project setup. |
Sure thing! If you manage to hook a debugger, it might interesting to see what threads are still running. Let us know what you find! |
@martinbonnin I boiled it down to this dependency:
If I add it to my project, the Java process exits as it should. Removing the line from your project will make your main running forever as well. Is this dependency adding something that the runtime dependency is not? |
Good catch! You can workaround by adding an explicit dependency to your project:
We were discussing with @BoD the opportunity to update OkHttp. Looks like that settles it. Also OkHttp 3 stop being supported in December 2021, yet another reason to update. |
Hi @andreaskaltenbach 👋 |
Yes, that's fine. I'll update to |
This is happening in the latest v3 stable release. |
(Just a note that this is followed up in #3802 - leaving this one closed for now) |
Summary
Using an Apollo Android Client and performing a query execute will make that the Java process never finishes.
Version
3.0.0 beta 04
Description
When running the following code, the Java process will terminate correctly with exit code 0:
If I uncomment the line which performs the
query.execute()
, the Java program will never terminate.Note that I even have to call
apolloClient.dispose()
explicitly. Otherwise the Apollo Client will prevent the process from finishing as well.Do
ApolloClient
andApolloQueryCall
have any resources that need to be cleaned up?The text was updated successfully, but these errors were encountered: