-
Notifications
You must be signed in to change notification settings - Fork 29
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
Exceptions thrown can sometimes result in two error dialogs #1796
Comments
@PathogenDavid interestingly, on my build and machine I only ever see one dialog, even though both code paths do get triggered. Even more interesting, if I comment the first call site, I don't see a popup, which was the situation presumably fixed by 724b2e0. Digging deeper, it looks like we are seeing the effects of capturing the |
I have identified one possible candidate for the race condition behavior, which is the use of bonsai/Bonsai.Editor/EditorForm.cs Line 1172 in 88a2412
Effectively this means that the call to I'm not sure how in your case you were able to get the second call scheduled before the dispose, but in any case I think using the fix proposed in #1795 together with removal of the first call to |
This is because of the move from
So looking at it again, the capture in #1795 is actually not really the right thing to do here. It actually creates a race condition rather than preventing it. When we were in our call I overlooked the fact that As such capturing
I checked the implementation of There's no race concern here, but is there a reason we're using Hiding things in the As for this issue (the two error dialogs), I think the real problem here is caused these two facts:
These two facts combine mean that non-workflow exceptions (as with the original implementation of #1787) will always show two dialogs. It might be easier to just handle the second fact for now and worry about the first one for Bonsai 3.0. I think |
Found another case which appears to trigger this: bonsai-rx/gui#29 |
This came up as an unrelated bug discovered via #1787
This happens due to the two
HandleWorkflowError
calls below:bonsai/Bonsai.Editor/EditorForm.cs
Lines 1229 to 1241 in 88a2412
First the call on line 1231 invokes the main thread to display the error, then the exception is rethrown on line 1233. It's then caught a second time by the
onError
handler on line 1241.If I remember correctly, during a more typical exception the first call will show a dialog but the second one will only highlight the node and put the exception in the status bar.
This difference comes down to the status of
building
in the first branch here:bonsai/Bonsai.Editor/EditorForm.cs
Lines 1413 to 1418 in 88a2412
It is however worth noting that two dialogs will appear no matter what when the second branch is entered. (As with the original 1787 fix.) So even if this comes down to something related to
building
there's still the potential for issues.The handle call on line 1231 was added by 724b2e0 which was trying to fix a bug introduced by 9c8e390 for #908
We theorized that potentially this fix was actually trying to fix what was actually a race condition in reading
building
byHandleWorkflowError
, but there's not enough context to say for sure. (See #1795)We agreed it didn't make much sense to have two
HandleWorkflowError
calls here, but because the issue supposedly fixed by 9c8e390 is pretty serious (two error dialogs is practically benign compared to completely silent errors), we don't want to risk a regression here by reverting that commit blindly and decided this issue warrants further investigation.The text was updated successfully, but these errors were encountered: