Thanks for your reply José.
I’m trapping the exits so I can make sure the connection gets closed if the worker is terminated for any reason.
When the worker dies, I expect that terminate will get called, which should then close the connection.
The connection doesn’t look to be another process, but a reference that is used as a key in the process dictionary to get the state of that connection. Inside that state we have the socket (Port). If the worker dies, it should take the port down with it.
I’m not using the Hackney pool because we want to parallelize the processing and building of responses on the worker.
The Fix:
It looks like I was able to get it to stop leaking by manually closing the connection when an {:error, :closed} tuple is returned.
I was expecting that if the client returned {:error, :closed}, it would have closed the port, but it looks like that’s not the case.
Thanks again for replying. There were some good suggestions of things to look into and it was a help.
Cheers,
Eric Goodwin