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

Add unwind feature flag #3211

Closed
wants to merge 1 commit into from
Closed

Add unwind feature flag #3211

wants to merge 1 commit into from

Conversation

kstrafe
Copy link

@kstrafe kstrafe commented Dec 3, 2020

Specifying the unwind feature flag removes the catch_unwind from
the task harness. This is especially useful for testing a program with
detached joinhandles.

Motivation

Solving #2699 to make testing easier to perform. Especially system tests where we have no control over spawned and detached tasks. Not all systems are going to be running with catch_unwind on each task. Some want to fail fast.

Solution

Adds a feature unwind to disable the usage of catch_unwind.

Specifying the `unwind` feature flag removes the catch_unwind from
the task harness. This is especially useful for testing a program with
detached joinhandles.
@carllerche
Copy link
Member

How does this work with the multi-threaded scheduler?

@kstrafe
Copy link
Author

kstrafe commented Dec 3, 2020

@carllerche no idea, I suppose the thread just swallows the panic. This is not intended for use with the multithreaded scheduler tho. So it can be somehow disabled for that.

@carllerche
Copy link
Member

If I understand the PR correctly, I don't think the feature flag is additive. feature flags should not change the behavior of code, only add new APIs or change internal runtime details.

I would suggest writing up a proposal considering how unwinding fits with the various schedulers. I added additional thoughts here: #2699 (comment)

I appreciate the PR, there is definitely unexpected complexity. I am going to close this PR. If you want to continue the effort, I would recommend opening an issue containing a proposal addressing the edge cases. You can also ping people in #tokio-dev on Discord (https://discord.gg/tokio).

@carllerche carllerche closed this Dec 4, 2020
@Darksonn Darksonn added A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-runtime Module: tokio/runtime labels Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-enhancement Category: A PR with an enhancement or bugfix. M-runtime Module: tokio/runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants