[squeak-dev] Re: Process bug introduced in 3.10

bryce at kampjes.demon.co.uk bryce at kampjes.demon.co.uk
Sun Apr 27 19:19:29 UTC 2008


Andreas Raab writes:
 > bryce at 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



More information about the Squeak-dev mailing list