Skip to content
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

Zombies HTTP connections raise TCP exception #25

Open
kremio opened this issue Nov 9, 2017 · 1 comment
Open

Zombies HTTP connections raise TCP exception #25

kremio opened this issue Nov 9, 2017 · 1 comment

Comments

@kremio
Copy link

kremio commented Nov 9, 2017

Hello,
I've noticed that after a certain number of queries, the following exception occurs:
Failed to open TCP connection to api.figo.me:443 (getaddrinfo: Temporary failure in name resolution)

I've wrote and ran a test to get more insight in the problem. Here is the pseudo code for the test:

loop do
connection = Figo::Connection.new(...)
connection.credential_login(...) #Doesn't matter if the credentials are valid, this is just to send a query
end

On my machine, the loop breaks because of the TCP connection error after exactly 241 iterations.

After looking a the source code for Figo::Connection, I noticed that the HTTP connection was never shutdown. So I extended Figo::Connection like so:

class FigoConnection < Figo::Connection
  def done
    @https.shutdown
  end
end

and modified the test to call done after each query:

loop do
connection = FigoConnection.new(...)
connection.credential_login(...) 
connection.done
end

and now the loop keeps on going after 241 iterations.
The same issue exists in Figo::Session (I haven't tested it but the HTTP connection is managed the same way)

For now, I'm going to extend Figo::Connection and Figo::Session to handle the termination of HTTP connections in my application code.

It would be extremely nice if the ruby-figo gem would manage the connection itself, so this would be transparent to the application code.

Best regards.

@felix1m
Copy link

felix1m commented Feb 27, 2018

I'm running into the same problem at the momment.

Is a fix for this planned?

In the meantime: @kremio did you fo anything besides creating the mentioned done method to Connection and Session or did you do further changes to the project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants