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

Job that exit hang (part of the) pool #178

Open
haf opened this issue Sep 19, 2018 · 2 comments
Open

Job that exit hang (part of the) pool #178

haf opened this issue Sep 19, 2018 · 2 comments

Comments

@haf
Copy link
Member

haf commented Sep 19, 2018

Let's say you have a function like

let rec f i =
  job {
    if i > 4 then () else
    do! timeOut 300
    return! f (i+1)
  }

And you >>=. (f 0) that, you'll indefinitely block the worker thread from taking any further work.

Similarly for exceptions, it would seem. So I suggest we track that all worker threads can be used, or even crash the app with a nice stacktrace if an unhandled exception or recursion like above ever reaches the library. Can we heuristically track "all worker threads are either executing jobs or waiting on a semaphore/monitor/WaitOne?

We should refactor towards this:

  1. Add the ability to hook an event on fatal exceptions (anything uncaught); this should be used for logging fatal/critical errors in production
  2. Handle "lost" threads
@haf haf self-assigned this Sep 19, 2018
@TheAngryByrd
Copy link
Contributor

I'd definitely be interested in finding out where worker threads get blocked.

@haf
Copy link
Member Author

haf commented Nov 21, 2018

Added some comments; I think this would be a nice first PR to Hopac for someone; trigger an event upon a job crashing.

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

No branches or pull requests

2 participants