Bloc icon indicating copy to clipboard operation
Bloc copied to clipboard

Image unresponsive when debugging a test with error in Test Runner

Open tinchodias opened this issue 5 years ago • 3 comments

Steps:

  1. Get P8.0 curl https://get.pharo.org/64/80+vm | bash
  2. Evaluate:
Metacello new
        baseline: 'NewBloc';
        repository: 'github://pharo-graphics/Bloc/src';
        load
  1. Open Test Runner, filter test packages with "Bloc", then select all test suites.
  2. Run tests to obtain the list of results (as in the screen capture below)
  3. Click on BlElementTest>>#testDefault and the image gets unresponsive (and cmd+. doesn't help). Terminal shows a recurrent error like shown below).
Screen Shot 2021-02-11 at 13 11 18

Stack trace:

Instance of BlUniverse did not understand #uiProcessDo:
BlUniverse(Object)>>doesNotUnderstand: #uiProcessDo:
[ :eachUniverse | 
| isUIProcess |
isUIProcess := false.
eachUniverse hostClass
	uiProcessDo: [ :eachUIProcess | isUIProcess := eachUIProcess == activeProcess ].
isUIProcess ] in MorphicUIManager>>spawnNewProcess in Block: [ :eachUniverse | ...
[ :each | 
(aBlock value: each)
	ifTrue: [ ^ foundBlock cull: each ] ] in Array(Collection)>>detect:ifFound:ifNone: in Block: [ :each | ...
Array(SequenceableCollection)>>do:
Array(Collection)>>detect:ifFound:ifNone:
MorphicUIManager>>spawnNewProcess
[ self spawnNewProcess ] in MorphicUIManager>>debugProcess:context:label:fullView:notification: in Block: [ self spawnNewProcess ]
CurrentExecutionEnvironment class>>activate:for:
DefaultExecutionEnvironment(ExecutionEnvironment)>>beActiveDuring:
DefaultExecutionEnvironment class>>beActiveDuring:
MorphicUIManager>>debugProcess:context:label:fullView:notification:
MorphicUIManager(UIManager)>>debugProcess:context:label:fullView:
Process>>debug:title:full:
Process>>debug:title:
MessageNotUnderstood>>debug
MorphicUIManager>>unhandledErrorDefaultAction:
UnhandledError>>defaultAction
UndefinedObject>>handleSignal:
UnhandledError(Exception)>>signal
UnhandledError class>>signalForException:
MessageNotUnderstood(Error)>>defaultAction
MessageNotUnderstood>>defaultAction
UndefinedObject>>handleSignal:
MessageNotUnderstood(Exception)>>signal
BlUniverse(Object)>>doesNotUnderstand: #uiProcessDo:
[ :eachUniverse | 
| isUIProcess |
isUIProcess := false.
eachUniverse hostClass
	uiProcessDo: [ :eachUIProcess | isUIProcess := eachUIProcess == activeProcess ].
isUIProcess ] in MorphicUIManager>>spawnNewProcess in Block: [ :eachUniverse | ...
[ :each | 
(aBlock value: each)
	ifTrue: [ ^ foundBlock cull: each ] ] in Array(Collection)>>detect:ifFound:ifNone: in Block: [ :each | ...
Array(SequenceableCollection)>>do:
Array(Collection)>>detect:ifFound:ifNone:
MorphicUIManager>>spawnNewProcess

tinchodias avatar Feb 11 '21 16:02 tinchodias

I explored a bit more on the stack trace and noticed that the infinite loop is triggered by MorphicUIManager>>#spawnNewProcess which is overriden by an extension method from the original:

spawnNewProcess

	UIProcess := [
		[WorldMorph doOneCycle.  Processor yield.  false] whileFalse: [].
	] newProcess priority: Processor userSchedulingPriority.
	UIProcess name: 'Morphic UI Process'.
	UIProcess resume

to

spawnNewProcess
	| activeProcess |
	
	"In case the current process is attached to a Bloc universe, stop pulsation to allow the new UI process to step.
	This assumes that the current process is the UI process and will be interrupted. "
	activeProcess := Processor activeProcess.
	BlParallelUniverse all
		detect: [ :eachUniverse |
			| isUIProcess |
			isUIProcess := false.
			eachUniverse hostClass
				uiProcessDo: [ :eachUIProcess | isUIProcess := eachUIProcess == activeProcess ].
			isUIProcess ]
		ifFound: [ :aUniverse | 
			aUniverse requestStopPulsation ]
		ifNone: [  ].
	
	UIProcess := [
		[WorldMorph doOneCycle.  Processor yield.  false] whileFalse: [].
	] newProcess priority: Processor userSchedulingPriority.
	UIProcess name: 'Morphic UI Process'.
	UIProcess resume

So a test may be adding a BlParallelUniverse whose hostClass doesn't respond to uiProcessDo:. May be an outdated test.

tinchodias avatar Feb 15 '21 17:02 tinchodias

Removing this test this issue doesn't reproduce:

BlDeferredActionTest>>
testDeferredAction
	| runFlag processflag |
	processflag := runFlag := false.
	BlUniverse reset.
	BlUniverse default
		start;
		defer: [ runFlag := true.
			processflag := BlUniverse default isUIProcess  ].
	(Delay forSeconds: 1) wait.
	BlUniverse reset.
	self assert: runFlag description:'the deferred action should be run'.
	self assert: processflag description:'the deferred action should be run within the UI Process'.

In my image, the implementors of #uiProcessDo: that can fit there as receives are BlHeadlessHost and BlMorphicSteppingHost (subclasses of BlHost).

In a GT image, I opened a Calypso on BlDeferredActionTest class and the test was red. I didn't debug it but looks like broken.

tinchodias avatar Feb 15 '21 17:02 tinchodias

Closed via commit c8ab99c

tinchodias avatar Feb 16 '21 00:02 tinchodias