Hi Bryce,
maybe if you use some #yield they have the chance to terminate before creating new ones restoring balance?
cheers,
Sebastian
-----Mensaje original----- De: squeak-dev-bounces@lists.squeakfoundation.org [mailto:squeak-dev-bounces@lists.squeakfoundation.org] En nombre de bryce@kampjes.demon.co.uk Enviado el: Domingo, 27 de Abril de 2008 16:19 Para: The general-purpose Squeak developers list Asunto: [squeak-dev] Re: Process bug introduced in 3.10
Andreas Raab writes:
bryce@kampjes.demon.co.uk wrote:
My next attempt at formulating a version of the same bug that'll run in a vanilla 3.10 image is:
100 timesRepeat: [processes := (1 to: 10) collect: [:each|
[[(MessageTally new spyEvery: 1 on: [(Delay forMilliseconds: 500) wait]) ] repeat] fork ].
(Delay forSeconds: 1) wait. processes do: [:each| each terminate].]
Running MessageTallies concurrently is a big, big no-no.
Check out class
MessageTally and in particular its (shared) class variables ObservedProcess and Timer.
Good point, but I can reproduce the bug without using MessageTally or any class variables. ExuperyProfiler doesn't use class variables.
The following will reproduce it: TestProfiler>>spyOn: aBlock | myDelay millisecs timer | millisecs := 1. (aBlock isMemberOf: BlockContext) ifFalse: [self error: 'spy needs a block here']. myDelay := Delay forMilliseconds: millisecs. timer := [[true] whileTrue: [myDelay wait]. nil] newProcess. timer priority: Processor userInterruptPriority. "activate the probe and evaluate the block" timer resume. aBlock ensure: [timer terminate]. ^ self
100 timesRepeat: [processes := (1 to: 10) collect: [:each| [[(TestProfiler new spyOn: [(Delay forMilliseconds: 500) wait]) ] repeat] fork ]. (Delay forSeconds: 1) wait. processes do: [:each| each terminate]]
TestProfiler is a new subclass of Object without any variables or any other methods.
I'm not convinced this is a new bug with 3.10. It feels similar to something I've encountered earlier. It is happening frequently in 3.10 but not in 3.9.
Bryce