-
Notifications
You must be signed in to change notification settings - Fork 14
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
Issue with cassandra ruby driver, timecop and ione #52
Comments
Hello! This is a tricky one. I haven't looked at the Ruby driver code for a long time, and also not done much work on Ione for a while, so I don't have all the details in my head at the moment. The Ione timers use I'm no fan of using timecop. Especially not for integration tests. In a single threaded environment and if you can be sure that nothing else runs when you change the time I guess it can work, if everyone plays ball (but there are better ways to do it in that situation). In a system with moving parts like Ione (which runs the reactor in a separate thread), there's no telling what will happen. If you tell me a little bit more about what you're trying to achieve, perhaps I can give you some advice on how to do it in a different way and work around the problem. |
@iconara let me push up a repo with a demonstration |
Sounds good. |
* Uses Process.clock_gettime(Process::CLOCK_MONOTONIC), which was added in Ruby 2.1, instead of Time.now. This prevents issues with scheduled timers when running alongside Timecop as reported in iconara#52 * Bumps minimum Ruby version to 2.1 * Updates Travis test ruby versions
I also encountered this issue, with errors like
and
I suspect that using a monotonic clock for timers e.g. Regardless, I was able to work around the issue by disabling the Cassandra driver heartbeat and idle timeout in the test environment with options:
|
I spent some time investigating this; it's definitely an issue with monotonic clocks and timecop. There are two issues: (1) I'll send over a PR for #2. |
datastax/ruby-driver#271 fixes ruby-cassandra-driver to use the newly-released Ione along with |
Hello @iconara!
Figured this would be as good of a spot as any to ask this question, but we discovered an issue when using ione with the ruby cassandra driver and timecop. Specifically, this is the situation.
idle_timeout
is set to the default value (60)Result:
The test will fail with a cassandra timeout error, as the scheduled ione timer for the idle_timeout has not been rescheduled, and the
on_value
timeout function has been called.Given this, I could see an argument for either calling this a cassandra ruby driver issue, or a ione issue--if you'd like me to report this somewhere else, please let me know.
However, my question is: What is the best way to utilize timecop with ione?
The text was updated successfully, but these errors were encountered: