[squeak-dev] Bug in Process>>#terminate | Returning from unwind contexts

Jaromir Matas m at jaromir.net
Sun Mar 28 08:34:57 UTC 2021


Hi Christoph, All,

I'm enclosing a changeset that could solve the original issue: unwind errors
and image instability after Abandoning the debugger in Christoph's example:

   [self error] ensure: [^2]

The unwind errors also appears in common situations like:

   [self error] ensure: [self error]

The root cause of the problem is that termination of a suspended process is
performed indirectly via #evaluate:onBehalf: in #popTo (as if in
simulation). Christoph described the problem above and elsewhere.

The solution may be to replace the #popTo: mechanism by having the suspended
process terminate itself as an active process by placing a new context atop
its stack to invoke #terminate, and resume the suspended process with the
active process' priority.

This, however leaves us with another problem: when a non-local return is
executed in an unwind block during termination the process may jump over
it's termination back to the original do-it code and continue executing -
which is in my opinion precisely the semantics of the non-local return in
this case (see #valueUninterruptably). But the problem is the original UI
process that started the do-it continues and the new UI process that opened
a debugger continues as well, alternating control.

To avoid this twin UI situation we have to make sure the original UI is
terminated after finishing execution of the do-it code that escaped its
termination via a non-local return. To do this we may insert a context
invoking #teminate under the DoIt context in the stack when we hit Abandon
and the debugger tries to terminate the debugged do-it code. We cannot
modify the stack sooner because we may hit Proceed and let the process
continue (which would close the new debugger process and leave the original
process as the sole UI process).

The change involves two methods only: Debugger>>windowIsClosing a
Process>>terminate. Please review the enclosed changeset with my comments;
I'd appreciate any feedback. 
Thanks!

NonLocalReturnTermination.cs
<http://forum.world.st/file/t372955/NonLocalReturnTermination.cs>  









-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list