-
-
Notifications
You must be signed in to change notification settings - Fork 389
capture error in worker thread #4342
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
Conversation
Okay, so what are the cases here?
So the case we need to handle is 2... but I think we have exactly the tool for that in the form of |
Session loading belong to a part of the evaluation of Rule Maybe @fendor knows which cases are likely to happen ? |
Actually I think I'm wrong and you were right: an unhandled exception can either go to the thread that launched the worker queue, or the thread that put the action into the queue. Probably the second option actually makes most sense, since it means that "run this action directly" and "run this action via the queue" behave the same in terms of where the exception goes. I wonder if there's a nice way to implement that behaviour using some of the existing concurrency pieces we have. This sort of thing can be very tricky, so I'd feel more comfortable if we were leveraging |
To be honest, I continue to think about my comment here: #4256 (review) A lot of this would be simpler if we were using locks!
In both cases the exception handling is pretty straightforward and under the control of the consumer. Haskell MVars are fair, so if we use a MVar-based lock we also should get things being scheduled reasonably. GHC does them in FIFO fashion, so we would even get the same queueing behaviour, but arguably this is a bit less good because it doesn't give us quite the same sequencing guarantees (does that matter?). |
So basically everywhere we have a |
Currently I do not find an existing api for such mechanism. Since the caller are different rule evaluation threads. The scoping is nasty here, so the |
|
Don't the restarts cancel the |
no, unless we can rewrite session loader like other rules and update the STM variables all togather in the hls-graph compute post hooker. Which is a rather hard work to do. Maybe we can add this into todo list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good now, thanks!
Fix #4340
let the caller handle the error happened during
awaitRunInThread
. In such case the HLS won't be stuck if the session setup fails and the LSP should be able to show the error to the client as other error cases happening in the rule system.cc @fendor