Bug 44675

GemStone/S 64 Bit

3.2.2, 3.2.1, 3.2,,,,,,, 3.1, 3.0.1, 3.0


SignalException during ensure block causes ensure block to be restarted

If an exception is signaled while the code in an ensure block is being executed, and if the exception is not resumable or the exception handler does not end with a #resume, the ensure block will be restarted.

The following example demonstrates the problem:

   | p stopEnsure |
   stopEnsure := false.
   p := [ [ [] ensure:
            [ GsFile stdout log: 'Executing ensure block'.
              [ stopEnsure ] whileFalse: [ 5000 factorial ]]]
      on: Error
      do: [:e | GsFile stdout log: 'Error signalled']]
          forkAt: 12.
   (Delay forSeconds: 1) wait.
   p signalException: (Error new details: 'error').
   (Delay forSeconds: 1) wait.
   stopEnsure := true.


If the error being signaled is resumable (a Notification in the example rather than an Error) and the exception handler code ends with a resume, then the code behaves properly

Last updated: 2/5/15