<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi all,</p>
<p><br>
</p>
<p>besides my proposed solution approach for the never-returning sends to <span>Context>>#runUntilErrorReturnFrom: [1], I recently stumbled upon another problem with context manipulation connected to #<span>runUntilErrorReturnFrom:. But I think the cause is
 a different one and this one brings up a more general design discussion. Let me explain:</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>The bug itself is pretty simple to reproduce:</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>1. <b>Do it:</b> </span></span><span style="font-size: 12pt;">[self error] ensure: [^2]</span></p>
<p>2. <b>Abandon</b> the Error debugger<br>
<span style="font-size: 12pt;"></span><span></p>
<div>3. <b>Do it: </b>self error</div>
<div><b>Expected behavior:</b> A second error debugger is shown</div>
<div><b>Actual behavior:</b> An unwind error (<span>Unwind error during termination)</span> is shown!</div>
<div><br>
</div>
<div>Here's an explanation: If you inspect your UI process after step 2, you will see that two guard contexts (<span>BlockClosure>>on:do: and <span>BlockClosure>>ensure:) are installed right before
<span>[] in BlockClosure>>newProcess</span> on the bottom of the sender stack. These contexts have been created by #<span>runUntilErrorOrReturnFrom: as part of the context popping-down performed by Process>>#terminate when abandoning the debugger. Normally,
 they would have been removed again after unwinding all contexts from the process (and the UI process would have been terminated and been replaced by a new one, see #<span>spawnNewProcessIfThisIsUI:</span>). But because our "ensure: [^2]" has stopped the unwinding,
 #runUntilErrorOrReturnFrom: and senders are still alive and waiting for the unwinding to complete while the UI process is continuing its everyday world cycles. When the next error is raised at any time later, the UnhandledError guard gets invoked and the signaler
 context is returned back from Process>>#popTo:, and Process>>#terminate complains that the unwinding has not been successful.</span></span></span></div>
<div><span><span><span><br>
</span></span></span></div>
<div><span><span><span>So far about the problem, here are some thoughts and questions:</span></span></span></div>
<div><span style="font-size: 12pt;"><br>
</span></div>
<div><span><span><span></span></span></span><span style="font-size: 12pt;">1.</span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;"><b>Should it be a legal operation at all to return from an unwind context?</b> (I think it should, because
 a) it works fine unless Process>>#terminate gets involved, and b) it is a powerful instrument for certain control flows that need to ignore all exceptions.)</span></div>
<div><span style="font-size: 12pt;">(1.1 If you think we should criminalize this operation, should we make efforts to exclude this behavior in #aboutToReturn:through: and other places? I fear this could become quite complex ...)</span></div>
<div><span style="font-size: 12pt;">2. <b>I'm attaching a small changeset to fix this issue</b> by
<b>decriminalizing unwind errors and continuing the execution</b> (with the new error)
<b>instead of showing an unwind error.</b> It's a small patch of three lines that works surprisingly well for my use case, but I'm not sure whether there could be any other justified reasons for showing an unwind error.
<b>Do you know some other relevant reasons for unwinding errors?</b></span></div>
<div><span style="font-size: 12pt;">3. Also, the solution approach begs a new question to me:
<b>Should the #terminate send indeed freeze for potentially hours of image time or millions of bytecodes,</b> or are we required to find another way for this? I hope for the first because I really can't imagine an elegant alternative at the moment.</span></div>
<div><span><span><br>
</span></span></div>
<div><span><span>Looking forward to your thoughts! :-)</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span>CC'ing Jaromir because you're working on the same method at the moment. Afaik you are only reworking the definition of #isTerminated, but probably you can share some interesting insights on this issue, too. :-)</span></span></div>
</span>
<p></p>
<p><span><br>
</span></p>
<p><span>Best,</span></p>
<p><span>Christoph</span></p>
<p><span><br>
</span></p>
<p><span>(PS: This message, as my previous one, has become quite long, I know this. General suggestions for reasonable shortening of my texts will be appreciated, I'm always trying to waste as little as possible of your time ... :-))</span></p>
<p><span><br>
</span></p>
<p><span>[1] <a href="http://forum.world.st/BUG-REGRESSION-while-debugging-Generator-nextPut-tp5108125p5127567.html" class="OWAAutoLink" id="LPlnk673209" previewremoved="true">http://forum.world.st/BUG-REGRESSION-while-debugging-Generator-nextPut-tp5108125p5127567.html</a></span><br>
</p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont">
<div><font size="3" color="black"><span style="font-size:12pt"><a href="http://www.hpi.de/" target="_blank" rel="noopener noreferrer" id="LPNoLP"><font size="2"><span id="LPlnk909538"><font color="#757B80"></font></span></font></a></span></font></div>
</font></div>
</div>
</font></div>
</div>
</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
</body>
</html>