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

Deadlocks In ParAff / Kills #4

Open
eric-corumdigital opened this issue Mar 29, 2019 · 4 comments
Open

Deadlocks In ParAff / Kills #4

eric-corumdigital opened this issue Mar 29, 2019 · 4 comments

Comments

@eric-corumdigital
Copy link
Contributor

There are several cases where deadlocks will occur if a Queue is used in any Fiber which is killed (ParAff is a common scenario).

read ∷ ∀ a. Queue a → Aff a
read (Queue q) = do
  readEnd ← AVar.take q.readEnd
  // Kill here leaves readEnd empty
  QItem a newRead ← AVar.read readEnd
  AVar.put newRead q.readEnd
  pure a

Invincibility is not a solution because that will lead to external deadlock problems. I have been long down this road with Aff, and even patched the library to fix a critical temporal issue that will also be at play here. When I am able to share the fix I will.

@safareli
Copy link

@eric-corumdigital with your recent work on Aff is it (or will it be) possible to fix this issues like this?

@safareli
Copy link

safareli commented Sep 22, 2019

I think this can be fixed using similar approach taken here and this is what's used under the hood.

@eric-corumdigital
Copy link
Contributor Author

I made my own implementation. The temporal kills fix allows you to use brackets properly, which in turn allows these sorts of issues to be resolved.

The implementation I am using now is just an AVar. Writing is launching a Fiber which puts to the AVar. Reading is taking from the AVar. Really simple.

@safareli
Copy link

The temporal kills fix allows you to use brackets properly, which in turn allows these sorts of issues to be resolved.

It would be great if you can you provide an example of how bracket with the fix can solve this issue.
Thanks!

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

No branches or pull requests

2 participants