-
Notifications
You must be signed in to change notification settings - Fork 80
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
Possible concurrency issues #86
Comments
Yes. I can't think of any datastore driver that would support being used concurrently from multiple threads. |
I am thinking e.g. of mysql, where you have a connection pool; the individual connections are synchronous but the pool itself is concurrent. I was assuming the driver as a whole got a single semian resource, not one per connection? |
It's one per connection. MySQL and other relational DB drivers don't handle pooling, you have to handle pooling higher in the stack. If one driver were to implement pooling, the semian adapter would have to take care of this concern indeed. |
OK, adapter mutexing takes care of the first issue ( |
By whom? I can't see a reason to call those methods except to simulate a test example, in which case threading isn't an issue. |
Ok, so as discussed offline. Because of this it should be thread safe. I'm working on a fix as we speak. |
Yeah, it was not designed to be 👍 to @casperisfine's direction. |
@casperisfine @sirupsen
I was poking around and found what I think are a few (hypothetical) issues when some semian methods are called concurrently. It's possible I'm missing something in the architecture (e.g are adapter methods expected to always be mutexed by the parent driver the way redis is?) but if not then here are some things I noticed:
retrieve_or_register
creating multiple instances of the same circuit-breaker and protected resourcerequest_allowed?
can "lose" successful responses by triggering multiple transitions to the half-open stateThe text was updated successfully, but these errors were encountered: