Bug 44675

GemStone/S 64 Bit

3.2.2, 3.2.1, 3.2, 3.1.0.6, 3.1.0.5, 3.1.0.4, 3.1.0.3, 3.1.0.2, 3.1.0.1, 3.1, 3.0.1, 3.0

3.2.3

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:

   run
   | 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.
   %

Workaround

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