Skip to content

Add lock to lazy dispatch - #9544

Closed
zklaus wants to merge 1 commit into
dask:mainfrom
zklaus:lazy-dispatch-race-condition
Closed

zklaus wants to merge 1 commit into
dask:mainfrom
zklaus:lazy-dispatch-race-condition

Conversation

@zklaus

@zklaus zklaus commented Oct 5, 2022 •

Copy link
Copy Markdown

This is a draft. Essentially, it adds a readers-writer lock using a new dependency to guard the lazy loading of dispatchers against a race condition. If you want to try it out, you must manually install the readerwriterlock package.

@GPUtester

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

Admins can comment ok to test to allow this one PR to run or add to allowlist to allow all future PRs from the same author to run.

@jrbourbeau jrbourbeau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @zklaus!

I don't think we should add a new dependency for this. If a lock is needed, let's use a theading / multiprocessing / etc. lock instead. Alternatively, I think avoiding the pop call until after registration has happened might also avoid the race condition. I'd be curious to get your thoughts on #9545.

@zklaus

zklaus commented Oct 6, 2022

Copy link
Copy Markdown
Author

I'll give the simpler approach a go and report in that issue. I agree that a new dependency should be avoided if possible and I was surprised to find that Python doesn't have a rwlock, c.f. python/cpython#53046.

@zklaus

zklaus commented Oct 14, 2022

Copy link
Copy Markdown
Author

Superseded by #9545.

@zklaus zklaus closed this Oct 14, 2022
@zklaus
zklaus deleted the lazy-dispatch-race-condition branch October 14, 2022 15:31
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

Successfully merging this pull request may close these issues.

Possible race condition in dask.utils:Dispatch.dispatch

3 participants