-
Notifications
You must be signed in to change notification settings - Fork 305
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
fixed 100% CPU problem under jruby #165
Conversation
@meesern thank you so much! I will take a look later today. |
@bernd this is relevant to your recent report. |
Please ignore the CI failure. Travis still hasn't upgraded to RabbitMQ 3.2 which has |
You are welcome - I believe it works well under jruby and 1.9.3 (which I don't think showed a problem). I can't see any reason why it shouldn't be stable on all platforms. Interestingly using the same jruby (1.7.3) the problem showed up more rapidly on 10.04 arm than 13.04 i64. |
Awesome! I cannot reproduce the problem anymore with JRuby 1.7.6 on Ubuntu 12.04 amd64. |
Is it okay that |
@bernd yes. So does I will run our benchmarks to see if this has any effect on CRuby. |
@michaelklishin I see. So you are going to remove the |
We will see. There is a separate per-operation timeout that will raise. The |
Thanks for the explanation! :) |
This change has a substantial impact on publishing throughput on CRuby (~7.85 kghz vs 12 kghz with |
@meesern can you confirm that full test suite passes for you on JRuby? I cannot get the suite to finish. |
No, I forgot to say rspec failed in quite a few ways before I started and didn't seem to be worse after. It looked like an incompatibility with my version of rabbitmq so I'm afraid I didn't pursue it. |
OK, I have the suite passing now. One exception is jruby/jruby#1055, finishing a work around for it. |
|
Sorry for being late to this discussion. I wonder if this implementation would solve the problem: def read_fully(count, timeout = nil)
value = ''
started_at = Time.now
while IO.select([self], nil, nil, timeout)
value << read_nonblock(count - value.bytesize)
break if value.bytesize >= count || (timeout && (Time.now - started_at) > timeout)
end
value
end (I've not included the Rubinious workaround, I don't really know what it worked around). The important bit is to do |
@iconara interesting idea. We will try it out and run our benchmarks to see if avoiding |
There was a mistake in the |
I can confirm that |
This change is to address a problem with Bunny locking up using 100% of a processor under jruby on ubuntu 12.04 i64 and ubuntu 10.04 arm after running for some hours.
The problem appears to be an operating system one where an EAGAIN exception is repeatedly raised on read_nonblock. Since the rescue and retry on retry exception classes exception handling exactly replicates the behaviour of the readpartial() method it seems reasonable to replace the misbehaving read_nonblock() with readpartial().
This fix is proving stable over time in the above long running systems.