Intermittent DNU using Delay
By Tony Garnock-Jones - Posted on January 6th, 2008
Tagged:
| Project: | GNU Smalltalk |
| Component: | VM |
| Category: | bug |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | invalid |
Description
The following test program will, in roughly 50% of its runs on my machine, generate the following backtrace immediately after the first "Global garbage collection... done" message. In the other runs, the global collection message prints and the program continues running without the backtrace. I'm not sure if the backtrace has caused any of the three Processes to exit.
Backtrace:
~$ gst threading-preemption.st "Global garbage collection... done" Object: nil error: did not understand #goodness: MessageNotUnderstood(Exception)>>signal UndefinedObject(Object)>>doesNotUnderstand: #goodness: optimized [] in BlockClosure class>>exceptionHandlerSearchBlock [] in Kernel.CoreException>>instantiateNextHandler: MethodContext(ContextPart)>>scanBacktraceForAttribute:do: Kernel.CoreException>>instantiateNextHandler: MessageNotUnderstood(Exception)>>signal UndefinedObject(Object)>>doesNotUnderstand: #key Delay class>>unscheduleDelay: Delay class>>handleDelayEvent optimized [] in Delay class>>runDelayProcess [] in BlockClosure>>ifCurtailed: BlockClosure>>ensure: BlockClosure>>ifCurtailed: Delay class>>runDelayProcess optimized [] in Delay class>>startDelayLoop [] in Process>>onBlock:at:suspend: BlockClosure>>on:do: [] in Process>>onBlock:at:suspend: BlockClosure>>ensure: [] in Process>>onBlock:at:suspend: [] in BlockClosure>>asContext: BlockContext class>>fromClosure:parent:
Code:
"Attempt to use a high-priority process to preempt lower-priority
processes. Doesn't work."
[
| d |
d := Delay forMilliseconds: 10.
[
d wait.
] repeat.
] forkAt: Processor highestPriority.
[
[
Transcript show: 'one'.
(Delay forMilliseconds: 10) wait.
] repeat.
] fork.
[
[
Transcript show: 'two'.
(Delay forMilliseconds: 10) wait.
] repeat.
] value.
Updates
#1 submitted by Paolo Bonzini on Sun, 01/06/2008 - 16:31
| Status: | active | » invalid |
It is not a good idea to use Delay in processes running at timingPriority or higher. There may be races between the process and Delay's coordinating process (which runs at timingPriority) in accessing Delay's data structures. Use highIOPriority instead.
