-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
console freezes in CONNECTING
state when there are too many tasks
#133
Comments
This is caused by a deadlock:
This happens so quickly because the channel might not be fully drained, but even if it was, One way to deal with this might be to suppress sending the notification by setting a flag when the |
It seems this is another case of using instrumented synchronization primitives inside the layer trying to react to the instrumentation causing unhappy times. |
Since a waker can trigger arbitrary code, such as with a custom waker, and even more so now that it can emit a tracing event that could do respond, we must be careful about the internal state when that code is triggered. The clone method of a waker is one of those instances. This changes the internals of `Notify` so that the waker is cloned *before* locking the waiter list. While this does mean that in some contended cases, we'll have made an optimistic clone, it makes `Notify` more robust and correct. Note that the included test case is built from an instance that did happen naturally in another project, see tokio-rs/console#133.
Since a waker can trigger arbitrary code, such as with a custom waker, and even more so now that it can emit a tracing event that could do respond, we must be careful about the internal state when that code is triggered. The clone method of a waker is one of those instances. This changes the internals of `Notify` so that the waker is cloned *before* locking the waiter list. While this does mean that in some contended cases, we'll have made an optimistic clone, it makes `Notify` more robust and correct. Note that the included test case is built from an instance that did happen naturally in another project, see tokio-rs/console#133.
…4129) Since a waker can trigger arbitrary code, such as with a custom waker, and even more so now that it can emit a tracing event that could do respond, we must be careful about the internal state when that code is triggered. The clone method of a waker is one of those instances. This changes the internals of `Notify` so that the waker is cloned *before* locking the waiter list. While this does mean that in some contended cases, we'll have made an optimistic clone, it makes `Notify` more robust and correct. Note that the included test case is built from an instance that did happen naturally in another project, see tokio-rs/console#133.
…okio-rs#4129) Since a waker can trigger arbitrary code, such as with a custom waker, and even more so now that it can emit a tracing event that could do respond, we must be careful about the internal state when that code is triggered. The clone method of a waker is one of those instances. This changes the internals of `Notify` so that the waker is cloned *before* locking the waiter list. While this does mean that in some contended cases, we'll have made an optimistic clone, it makes `Notify` more robust and correct. Note that the included test case is built from an instance that did happen naturally in another project, see tokio-rs/console#133.
CONNECTING
state when there are a little many tasksCONNECTING
state when there are too many tasks
It seems that the console doesn't freeze for the example now. |
thanks @hatoo ! closing as fixed then. (I'm not sure if it was fixed by PR tokio-rs/tokio#4129, or by something else that happened in the meantime, but I don't think we are going to attempt to track down the exact cause of the fix.) |
console freezes in
CONNECTING
state to this application.As commented above, it's Ok if the number of spawned futures is small or sleep duration is large.
The text was updated successfully, but these errors were encountered: