-
Notifications
You must be signed in to change notification settings - Fork 327
Dealing with {dead,live}locked applications #264
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
Comments
I think it'd be really cool, if we could have it and be part of an even larger middleware that provides more common instrumentation, including custom ones (Similar to https://golang.org/pkg/expvar/) |
Since we're talking about PoisonError and parking-lot, as a PSA, please look to Usage becomes: // in request
let the_thing = cx.state().the_thing.lock().await; No This is probably out of scope of Tide and more of something that Rust should be doing but IO-blocking behavior in an |
Unless the waker panics when attempting to wake another task if we abandon acquiring the mutex, that will poison the Much lower scope of poisoning since Probably would still be good to have a better example of live-locking that doesn't involve such unlikely situations/using incorrect synchronization primitives ( |
Fair enough. I had meant you don't need to deal with the potential error return but it seems its a panic instead.. not sure I like that. I didn't review the lock that closely.
Totally agree that good examples should be done. I do feel Mutexs in general (even using a futures-aware mutex) in async code is weird. You generally want a lockfree data structure if anything, state is bad (tm) and all that.
It was in futures v0.1. Not sure the reasoning to rename the module in 0.3. |
Notes from triage: this is not a priority at the moment, but we do think we'll eventually want to revisit this. We're keeping the issue open to track the discussion. |
While I agree with the general notion, I believe the application should not continue running and wait for an external restart. It should immediately crash, letting a supervisor restart it. |
Uh oh!
There was an error while loading. Please reload this page.
This is mostly an application design issue, but maybe there are ways in which Tide can help users to design their application, or provide middleware that can detect/help resolve issues.
There's a few ways an application can get itself {dead,live}locked, e.g. deadlocking while locking multiple mutexes from the application
State
, panicking while holding a mutex such that all future requests instantly error with aPoisonError
.A common way to deal with this in todays landscape of service supervisors is to have a "health check" endpoint which verifies whether the service is currently usable, then a supervisor (such as Kubernetes) uses this endpoint to check if an instance of the service should be taken out of rotation and restarted. Tide could potentially provide pieces of a solution like this to make it easier for developers, or include examples of how such an endpoint could be designed to guide developers.
(split off from #263 (comment))
The text was updated successfully, but these errors were encountered: