Close dnsNameResolver in AlgoliaHttpClient.close() #500
Labels
Comments
Hello @tanin47 thank you for reporting this issue. It indeed looks like a bug on our end, and we'll consider closing the DNS resolver on our end to avoid any socket leak. Thank you for reporting this and sorry for the inconvenience it may have caused. |
aseure
added a commit
that referenced
this issue
Jan 7, 2019
Ant-hem
added a commit
that referenced
this issue
Jan 7, 2019
Ant-hem
added a commit
that referenced
this issue
Jan 8, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
dnsNameResolver
isn't closed whenAlgoliaHttpClient.close()
is invoked. This can causeCaused by: java.net.SocketException: maximum number of DatagramSockets reached
.This happens when running Playframework locally with its auto-reload magic. It keeps instantiating a new
AlgoliaClient
when the code is changed. I use Play's shutdown hook to clean upAlgoliaClient
properly when the code is reloaded. Unfortunately,dnsNameResolver
isn't closed properly.But, fortunately,
dnsNameResolver
is a public member, so I still can close it myself. Thanks you for scoping these members to public.Steps To Reproduce
Here's a simple code to reproduce it:
Then, run with
sbt -Dsun.net.maxDatagramSockets=3 'runMain scripts.TestAlgolia'
. It will fail after creating 3AlgoliaClient
s.The text was updated successfully, but these errors were encountered: