-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
RFC: fix race condition on task failure #12736
Conversation
ref #12403 |
So this means that if a |
Basically yes, but |
That seems fair. What about printing the error if the |
With those other behaviors, we would still need the Tying stuff to GC is no good, since it is wildly unpredictable. FWIW, I believe erlang does the same thing, keeping process failures silent unless another process is watching. |
If Erlang does it that way, it's probably the right thing to do, but it does worry my letting things fail and fall into the void. |
That's part of Erlang's whole model, I not sure it would be truly applicable to Julia. Silent failures give me the creeps. |
I think of it in terms of general asynchronous programming. For example, what should
do? Indeed, it just sits there seemingly doing nothing until you try to fetch the answer. I don't recall many complaints about this. |
I'm a little worried about uses cases such as:
There should probably be a good way to print the error message. Maybe just a macro that wraps everything in try catch and calls the appropriate |
I think the best approach is something like
You want to use |
Could the starting process asynchronously get the message (in a thread?), and keep it until the main thread |
Yes that sounds possible, but it seems to only affect resource use and not when errors get printed. |
I've had cases of filling up process tables or hitting OS limits on number of processes on different platforms, which is why that can be important |
Agreeing with Keno's concern. The printing of errors is useful when using |
I am OK with printing unhandled errors based on an an environment flag - say, JULIA_DEBUG=0/1, with the default being off, i.e., no printing. This addresses development time issues, where sometimes misspelling a variable name, or other syntactical errors can be discovered quickly. If you expect runtime errors, then you should wrap your async block in a try-catch and handle it properly. |
Some kind of environment var would be ok I guess. One reason I find this important is that it's actually not just a matter of whether errors are expected within a certain task. It's about order of events. For example |
Can't the way you suppress raising exceptions be to explicitly wait on a task and wrap the wait in try/catch? It seems fine to me to make it hard to ignore exceptions. |
No, because a task usually starts before anybody calls |
Implemented in #39518 |
We tried adding this message. It was a worthwhile experiment and seemed like a good idea, even to me, but at this point I just can't take it any more.
The message is a race condition, because the order of task T running and another task calling
wait(T)
now matters, where it didn't before. This has led to the need for aSUPPRESS_EXCEPTION_PRINTING
flag, which is just silly.