-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
rt: overhaul task hooks #7197
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
base: master
Are you sure you want to change the base?
rt: overhaul task hooks #7197
Conversation
I'll fix CI tomorrow. |
Just reading the API, I really like this. I think its an API that allows us to expand in the future (especially if there isn't a huge perf hit by virtue of open-ended I might consider keeping the current hook APIs (but implementing them behind the scenes with the new API). I think, ultimately, they may still be simpler for some use cases. |
Thank you for the feedback! Expandability was one of my main priorities with this changeset, and I'm delighted to hear that others are also excited about this. Regarding keeping both sets of hooks around, I don't think this is a great idea due to the complexity of the systems involved, and I honestly just wanna get rid of the old APIs as they were never very good to begin with. That being said, I don't think it will be much work for folks to migrate over, and my hope is that we can leave this API completely unchanged even while we let it bake prior to stabilization, so hopefully no more migrations will be needed. |
I'm running into some issues with loom, and I'm currently unsure if this is because of an actual issue or just false positives. @Darksonn do you have any idea what might be causing the current failures with the multi-threaded scheduler? |
Hmm, it looks like the loom failure log is not showing up on ci? ... I captured this locally anyway: logs
I haven't looked the entire code, but I suspect there's a data race caused by a concurrent write to an |
One of the loom tests (pool_shutdown) is timing out because it goes on too long, probably because somehow the number of branches is exploding. |
75c21b5
to
8963b5d
Compare
This part of the problem I think is because the loom-compile CI workflow doesn't build with However,
As I think we only care about the mutable reference to the I've pushed that change, a ci.yml update for release builds in loom tests, and a rebase, in my fork at https://github.com/LloydW93/tokio/tree/lloyd/the-hookening - let me know if you just want to pull the commits into your branch or would rather a new PR. |
In both CONTRIBUTING.md, and in loom's own documentation, it is recommended to run loom's tests with the --release profile, as they execute many permutations of the same test and therefore compilation time benefits are worthwhile. In tokio-rs#7197 we see this with some individual tests taking over 60s to complete.
8963b5d
to
de227f8
Compare
This change overhauls the entire task hooks system so that users can propagate arbitrary information between task hook invocations and pass context data between the hook "harnesses" for parent and child tasks at time of spawn. This is intended to be significantly more extensible and long-term maintainable than the current task hooks system, and should ultimately be much easier to stabilize.
de227f8
to
0095c7f
Compare
Thanks Lloyd for digging into this! I've applied your suggestions and that fixed the loom issues. |
Can you make a module for all the hook types and traits so we don't pollute |
This is a very involved change, including non-trivial changes to runtime internals and complex APIs. Before moving forward with this PR, we need to start with a proposal that explains the motivation, problem being solved, etc. I don't know what problem this is trying to solve. |
Documented the motivation in #7306 |
Sure! |
Left my comments on the RFC, as they were around goals / high-level API rather than impl. |
This change overhauls the entire task hooks system so that users can propagate arbitrary information between task hook invocations and pass context data between the hook "harnesses" for parent and child tasks at time of spawn.
This is intended to be significantly more extensible and long-term maintainable than the current task hooks system, and should ultimately be much easier to stabilize.
See #7306 for motivation.