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 option to spawn timer tasks to avoid stickiness #56745

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Dec 3, 2024

Currently Timer(f, 1) will create a sticky task and have the same effect as @async in making the parent task also sticky.

I'm not sure if this should be treated as a bugfix (i.e. backport) or a minor behavior change (i.e. introduce in 1.12).

Or just an opt-in new feature, so spawn=false by default.


Now off by default.

@IanButterworth IanButterworth added the multithreading Base.Threads and related functionality label Dec 3, 2024
@oscardssmith
Copy link
Member

Why is this a new option? Isn't spawning strictly better?

@IanButterworth
Copy link
Member Author

In case there are use cases where code relies on the behavior. Maybe not needed?

@vchuravy
Copy link
Member

vchuravy commented Dec 6, 2024

Maybe not needed?

Sadly needed.

base/asyncevent.jl Outdated Show resolved Hide resolved
base/asyncevent.jl Outdated Show resolved Hide resolved
Co-authored-by: Valentin Churavy <[email protected]>
@IanButterworth IanButterworth changed the title Spawn timer tasks to avoid stickiness Add option to spawn timer tasks to avoid stickiness Dec 6, 2024
@oscardssmith
Copy link
Member

Sadly needed.

why is it needed?

@gbaraldi
Copy link
Member

gbaraldi commented Dec 9, 2024

We should also look for uses of Timer and change them. I also think that this should change the default. Having spooky action at a distance be why someones code is working is not correct. The fact that we sticky is not documented anywhere.

@IanButterworth
Copy link
Member Author

IanButterworth commented Dec 10, 2024

What about spawn if the parent task isn't sticky already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants