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

Support custom timeouts for PB socket #265 [JIRA: CLIENTS-859] #265

Closed
wants to merge 2 commits into from
Closed

Support custom timeouts for PB socket #265 [JIRA: CLIENTS-859] #265

wants to merge 2 commits into from

Conversation

boosty
Copy link
Contributor

@boosty boosty commented Apr 26, 2016

This PR adds support for custom connect, read and write timeouts for the protobuff socket.
The default timeouts by the OS are usually too high for a production app. Smaller timeouts allow the client to try another node more quickly in case of socket problems.

Ported from https://github.com/xing/riak-ruby-client/commit/67f28e1.

@Basho-JIRA Basho-JIRA changed the title Support custom timeouts for PB socket Support custom timeouts for PB socket #265 [JIRA: CLIENTS-859] May 13, 2016
@lukebakken lukebakken added this to the riak-ruby-client-2.4.0 milestone Jun 8, 2016
@lukebakken
Copy link
Contributor

@boosty I have opened #270 which incorporates your commits and resolves some conflicts. The timeout tests don't always succeed, sometimes the RuntimeError is raised, sometimes not. I'll look into it. Thank you for the PR.

@lukebakken lukebakken closed this Jun 8, 2016
@boosty
Copy link
Contributor Author

boosty commented Jun 8, 2016

Hi @lukebakken, thanks for the update!
Since I don't have access to your buildbot results, could you let me know which of the tests are flaky (connect, read, write)? We can also continue the discussion in #270.

@boosty
Copy link
Contributor Author

boosty commented Jun 8, 2016

@lukebakken: Can you get the tests to pass if you lower the timeouts in spec/integration/riak/protobuffs/timeouts_spec.rb from 0.0001 to e.g. 0.00001?

@lukebakken
Copy link
Contributor

read and write are flaky, since they interact with my local Riak node. No matter how low I make the timeout, it's not 100% consistent - apparently my VM is just too fast 😄

I'm just going to code up a simple TCP server for these two tests, like I have here in the Node.js client

@boosty
Copy link
Contributor Author

boosty commented Jun 8, 2016

Good idea! This way you can slow down the server response as you wish.

Either your system is really too fast, or it might be that the timeout option for IO.select is not equally fine-grained on every system.
I am curious: What setup are you using? I was running the tests successfully on OS X (El Capitan, Ruby 2.3.1) against riak-ruby-vagrant in VirtualBox.

@lukebakken
Copy link
Contributor

I'm running Arch Linux in a Hyper-V VM on Windows 10, with this version of Ruby:

$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

Riak 2.1.4 (built with make locked-deps && make stagedevrel) is running in the same VM. man 2 select shows that it does accept seconds and microseconds, so who knows?

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

Successfully merging this pull request may close these issues.

3 participants