Christoph Thiede uploaded a new version of Chronology-Core to project The Trunk: http://source.squeak.org/trunk/Chronology-Core-jar.91.mcz
==================== Summary ====================
Name: Chronology-Core-jar.91 Author: jar Time: 7 January 2024, 1:50:33.62718 pm UUID: 449881a6-d6f2-1748-a77b-16c0a300483c Ancestors: Chronology-Core-jar.90
an alternative fix of a bug in #valueWithin:onTimeout: described in Chronology-Core-jar.90
FYI: Issue: the method starts a watchdog at high priority before entering the ensure: method. But the active process may terminate before entering the ensure: inside valueWithin:onTimeout:, and thus the cleanup ensure argument block will not be executed during the unwind. As a result the watchod will assume the active process has not completed the watched block and will erroneously signal the TimedOut exception and a failure (BCR exception) inside #signalException will follow.
=============== Diff against Chronology-Core-jar.90 ===============
Item was changed: ----- Method: BlockClosure>>valueWithin:onTimeout: (in category '*chronology-core') ----- valueWithin: aDuration onTimeout: timeoutBlock "Evaluate the receiver. If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead"
| theProcess delay watchdog tag |
aDuration <= Duration zero ifTrue: [^ timeoutBlock value ].
"the block will be executed in the current process" theProcess := Processor activeProcess. delay := aDuration asDelay. tag := self.
"make a watchdog process" watchdog := [ + delay wait. "wait for timeout" + theProcess signalException: (TimedOut new tag: tag) - delay wait. "wait for timeout or completion" - theProcess ifNotNil:[ theProcess signalException: (TimedOut new tag: tag)] ] newProcess.
"Watchdog needs to run at high priority to do its job (but not at timing priority)" watchdog priority: Processor timingPriority-1.
"catch the timeout signal" + ^ [[watchdog resume. "start up the watchdog" + self value] ensure: [ "evaluate the receiver" + watchdog terminate. "exit the watchdog" - ^ [ [watchdog resume. "start up the watchdog" - self value] ensure:[ "evaluate the receiver" - theProcess := nil. "it has completed, so ..." - delay delaySemaphore signal. "arrange for the watchdog to exit" ]] on: TimedOut do: [ :e | e tag == tag ifTrue:[ timeoutBlock value ] ifFalse:[ e pass]].!
squeak-dev@lists.squeakfoundation.org