-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fixes intermittent ConcurrencyError seen in JRuby #670
Conversation
I wonder what is the contract for IO operations in ruby? I had an impression that they are supposed to be thread-safe. Am I wrong? |
Not sure on the IO contract (maybe someone lurking from @jruby can chime in here). But I do know that the Array type used by https://github.com/jruby/jruby/wiki/Concurrency-in-jruby#core-classes-and-standard-library Hence the concurrency error when multiple threads attempt to write to and read from the interceptor buffer. |
end | ||
|
||
def buffer | ||
lock.synchronize do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to return the buffer itself not its copy. Are you sure it is safe to return a copy here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, its really just another thread safety precaution to protect buffer from being accessed/written to from separate threads. As far as I can tell, It looks like buffer is currently only being used by the junit formatter in after_feature
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for clarification.
Fixes intermittent ConcurrencyError seen in JRuby
I'm on RailsConf now so will not be able to release a new version until next week. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This fixes a ConcurrencyError seen intermittently in JRuby 1.7.4 where a separate native thread was writing to stdout. This error was observed in v1.3.8.
This may be an issue for other non-MRI versions of ruby as well.