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
run command: should threads be able to keep themselves running after interrupt? #4894
Comments
The correct protocol for interruption is to clean resources and rethrow, never swallow a ThreadKilled. However, when I did the latest change to some of the relevant code (to not log ThreadKilled) I decided to not change the current behaviour for now, to avoid muddying the waters until we understand what's going on |
To be clear to those less familiar with the context, I think that @SystemFw is referring to changes that he made in the @SystemFw in cases like that, where it is at the top level of a forked thread, I don't know if there is really a better option. |
that's true, but if you see in the whole chain of calls from Tcp server and up there are quite a few places that call Also, just repeating what I said on Slack wrt worst case scenario: in the current Unison model on the Haskell runtime there is no way to guarantee the release of something, if you’re unlucky enough. catchAll : '{IO, Exception} a ->{IO} Either Failure a and so if you have
and you are unlucky enough, something will terminate naturally, but then interruption will hit in between The situation is also complicated by what the scheme runtime does, and basically I have held back from designing proper semantics because my preliminary analysis is that supporting it on both the Haskell and the Scheme runtime is nigh impossible |
I just noticed that when I did a
ctrl-c
on arun
, the main thread stopped but a child thread continued to run. After trying a few variations, it seems like this happens ifcatchAll
(or something similar based ontryEval
) catches the thread killed exception. On the one hand, there's an argument for letting a thread catch the thread kill to clean up resources. But in the case of the thread being killed, it seems like it should have to reraise the failure or be shut down after a grace period or something.Here is an example:
The text was updated successfully, but these errors were encountered: