-
Notifications
You must be signed in to change notification settings - Fork 6
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
recover from (concurrent) handler removal #6
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@benlangfeld could you share your thoughts when you get a chance? |
benlangfeld
requested changes
Nov 18, 2016
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.
Changelog entry please :)
benlangfeld
approved these changes
Nov 18, 2016
This just needs conflicts resolving :) |
meh the changelog ... on it! |
…ss garbage) ... mostly future proof as with current TS::Cache setup it is not expected to happen
…as a special marker)
tmp handlers are removed after they're called from the Array holding them in rare cases when the removal happens just as handlers_of_type (for the same type) are being push-ed among collected `values`, the value Array to be added might get modified concurrently - under JRuby : ``` #<ConcurrencyError: Detected invalid array contents due to unsynchronized modifications with concurrent users> /opt/local/rvm/gems/jruby-1.7.4@dialogtech/bundler/gems/has-guarded-handlers-4d4980673764/lib/has_guarded_handlers.rb:180:in `handlers_of_type' org/jruby/RubyArray.java:1617:in `each' /opt/local/rvm/gems/jruby-1.7.4@dialogtech/bundler/gems/has-guarded-handlers-4d4980673764/lib/has_guarded_handlers.rb:178:in `handlers_of_type' /opt/local/rvm/gems/jruby-1.7.4@dialogtech/bundler/gems/has-guarded-handlers-4d4980673764/lib/has_guarded_handlers.rb:131:in `trigger_handler' ``` in such cases re-trying the operation (re-reading the value Array) is safe and unlikely to fail again!
the ConcurrencyError on JRuby's Array impl is mostly a nice feature ... it's hard to reproduce concurrent behavior - but its smt at least!
`class ConcurrencyError < ThreadError` not available on MRI
kares
force-pushed
the
up-thread-safety-23
branch
from
November 18, 2016 11:52
c35d0ad
to
f85f80a
Compare
rebased, thanks for looking into it Ben. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... a follow up from #5
(under JRuby) for some specific use-cases more concurrency fixes are needed to run AHN safely.
there's 2 errors @cloudvox managed to run into (using JRuby 1.7) which both related to the same issue
trigger_handler :ami
is happening concurrently, on JRuby :they both happen since
PB::Translator::Asterisk::Call
instances are no longer actors ... the changes proposed assure this case is covered correctly.the later can be reproduced by running the following minimal (only HGH) script under JRuby ... simply
TIMES=1000 concurrency-issue-simplified2.rb
should do (make sure togem install concurrent-ruby
)alternatives to solving the issue would be :
Call
's handler triggering)Call
instances (there's also one inComponent::Record
)