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

Connection timeout #40

Closed
rzane opened this issue Dec 9, 2014 · 2 comments
Closed

Connection timeout #40

rzane opened this issue Dec 9, 2014 · 2 comments

Comments

@rzane
Copy link

rzane commented Dec 9, 2014

As best I can tell, there is no timeout when establishing a connection. The following script ran for about 4 minutes on my machine:

#!/usr/bin/env ruby
require 'fb'

Fb::Database.new(
  database: 'fakeurl.com:/fake/database/path.fdb',
  username: 'sysdba',
  password: 'masterkey'
).connect

When it finally did exit, this was the error:

$  time ./connection_timeout.rb
./connection_timeout.rb:8:in `connect': Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements (Fb::Error)
Unable to complete network request to host "fakeurl.com".
Failed to establish a connection.
    from ./connection_timeout.rb:8:in `<main>'
./connection_timeout.rb  0.07s user 0.02s system 0% cpu 4:16.76 total

The connection should probably bail after a certain amount of time. Ideally, this amount of time would be configurable in the connection hash. I'm not a C guy, so I'm not sure I'll be of any help.

@rowland
Copy link
Owner

rowland commented Dec 10, 2014

The gem is a wrapper around fbclient, which does not have a timeout setting, to my knowledge. Nor do we have access to the socket used by fbclient or we could specify a timeout on the socket. Fortunately, in practice, this is rarely a problem. Most database connections are local and fail quickly if they are going to fail.

@rzane
Copy link
Author

rzane commented Dec 10, 2014

Okay. Thanks anyway.

@rzane rzane closed this as completed Dec 10, 2014
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