Skip to content
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

Tasks have lost their wakers #3112

Open
IlliaJoker opened this issue Dec 27, 2024 · 8 comments
Open

Tasks have lost their wakers #3112

IlliaJoker opened this issue Dec 27, 2024 · 8 comments

Comments

@IlliaJoker
Copy link

IlliaJoker commented Dec 27, 2024

While monitoring tasks using tokio-console, I see the following issue:
task has lost their wakers: /axum-0.8.0-rc.1/src/serve.rs:268:13
image

@Turbo87
Copy link
Collaborator

Turbo87 commented Dec 27, 2024

can you share a project that reproduces the issue? without more details this is a bit hard to debug

@paolobarbolini
Copy link
Contributor

That's probably just because the Future returned by tokio::spawn is dropped https://docs.rs/crate/axum/0.8.0-rc.1/source/src/serve.rs#268

@IlliaJoker
Copy link
Author

IlliaJoker commented Dec 27, 2024

@paolobarbolini Is this correct behavior for this case?

@paolobarbolini
Copy link
Contributor

paolobarbolini commented Dec 27, 2024

@paolobarbolini Is this correct behavior in this case?

It might be, but I'm not sure. One thing I'd try doing, since I see you're using an outdated tokio version (1.39.2), is update everything via cargo update and see if anything changes. I don't have much experience with tokio-console but it might be just a false positive. Going through their issues they had some of those in the past.

@Turbo87
Copy link
Collaborator

Turbo87 commented Dec 27, 2024

it looks like tokio-console points to https://github.com/tokio-rs/axum/blob/axum-v0.8.0-rc.1/axum/src/serve.rs#L268-L272, and, if I understand correctly, the only waker in this task is the signal, which is passed into the with_graceful_shutdown() fn. if that passed in signal loses its waker then that seems most likely not something that is controlled by axum, but by the surrounding code. you might want to check what you pass into with_graceful_shutdown() and whether that is dropped early or anything like that. as I mentioned above, without a project that reproduces the issue this is very hard to debug.

@jplatte
Copy link
Member

jplatte commented Dec 27, 2024

To me this seems pretty likely to be when not using graceful shutdown, where internally we use a graceful shutdown future of std::future::Pending IIRC. This means the wait-for-graceful-shutdown task leaks. We should probably fix that.

@IlliaJoker
Copy link
Author

I added graceful shutdown to my project, and it helped eliminate task leaks.
Thank you!

@jplatte
Copy link
Member

jplatte commented Dec 29, 2024

I think this should also fix it: #3129
Can somebody confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants