Terminating a terminator process fails to unwind the original process

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Terminating a terminator process fails to unwind the original process

Jaromir Matas
Hi, there's an issue when a process terminating another process is terminated in the middle of the unwind.

As a result the original process won't finish unwinding and will leave either a suspended process or a chain of unfinished contexts behind (to be GC'd).

Here's a test: KernelTests-jar.406

        | terminator terminatee unwound |
        unwound := false.
        terminatee := [[Processor activeProcess suspend] ensure: [unwound := true]] fork.
        Processor yield.
        terminator := [terminatee terminate] newProcess.
        self assert: terminatee isSuspended.
        self assert: terminator isSuspended.
        terminator runUntil: [:ctx | ctx selectorToSendOrSelf = #suspend]. "first #suspend in #terminate"
        self assert: terminator isSuspended.
        terminator terminate.
        self assert: terminator isTerminated.
        self assert: unwound

Wrapping the whole termination code into the argument block of #ensure: should solve the problem. Here's a proposed version of #terminate: Kernel-jar.1412
best,
^[^ Jaromir