Description
Hi @isCzech, all,
I've discovered another situation while I get a "Computation has terminated" error from Process>>#terminate
. The entire situation is pretty complex, depends on some experimental code that I have not yet commited to third-party packages, and occurs only very sporadically (that terminate
is maybe getting sent thousands of times per day and fails every second day...) - so it won't be possible to clearly reproduce right now. Nevertheless, I'm trying to collect as many information about the bug here as possible and hope it helps:
First debugger:
Bug report
15 January 2024 5:43:58.314083 pm
VM: Win32 - Smalltalk
Image: Squeak6.1alpha [latest update: #22943]SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir C:\Users\Christoph\OneDrive\Dokumente\Squeak
Trusted Dir C:\Users\Christoph\OneDrive\Dokumente\Squeak\Christoph
Untrusted Dir C:\Users\Christoph\OneDrive\Dokumente\My SqueakContext(Object)>>error:
Receiver: FullBlockClosure(BlockClosure)>>ensure:
Arguments and temporary variables:
aString: 'Computation has been terminated!'
Receiver's instance variables:
sender: [] in Context>>handleSignal:
pc: nil
stackp: 4
method: (BlockClosure>>#ensure: "a CompiledMethod(1093181)")
closureOrNil: nil
receiver: [closure] in Context>>handleSignal:Context>>cannotReturn:
Receiver: FullBlockClosure(BlockClosure)>>ensure:
Arguments and temporary variables:
result: FullBlockClosure(BlockClosure)>>on:do:
Receiver's instance variables:
sender: [] in Context>>handleSignal:
pc: nil
stackp: 4
method: (BlockClosure>>#ensure: "a CompiledMethod(1093181)")
closureOrNil: nil
receiver: [closure] in Context>>handleSignal:FullBlockClosure(BlockClosure)>>ensure:
Receiver: [closure] in Context>>handleSignal:
Arguments and temporary variables:
aBlock: [closure] in Context>>handleSignal:
complete: true
returnValue: nil
Receiver's instance variables:
outerContext: Context>>handleSignal:
startpcOrMethod: ([] in Context>>#handleSignal: "a CompiledBlock(2105497)")
numArgs: 0
receiver: FullBlockClosure(BlockClosure)>>on:do:[] in Context>>handleSignal:
Receiver: FullBlockClosure(BlockClosure)>>on:do:
Arguments and temporary variables:
exception: UndeclaredVariableNotification:
val: nil
Receiver's instance variables:
sender: [] in FullBlockClosure(BlockClosure)>>on:do:on:do:
pc: 34
stackp: 4
method: (BlockClosure>>#on:do: "a CompiledMethod(1946039)")
closureOrNil: nil
receiver: [closure] in ECGlobalEntry(ECEntry)>>tryPredictResultWith:andDo:FullBlockClosure(BlockClosure)>>ensure:
Receiver: [closure] in Context class>>contextEnsure:
Arguments and temporary variables:
aBlock: [closure] in FullBlockClosure(BlockClosure)>>valueAndWaitWhileUnwinding:...etc...
complete: true
returnValue: nil
Receiver's instance variables:
outerContext: Context class>>contextEnsure:
startpcOrMethod: ([] in Context class>>#contextEnsure: "a CompiledBlock(2240957...etc...
numArgs: 0
receiver: Context
--- The full stack ---
Context(Object)>>error:
Context>>cannotReturn:
FullBlockClosure(BlockClosure)>>ensure:
[] in Context>>handleSignal:
FullBlockClosure(BlockClosure)>>ensure:
At the same time, the UI hangs, and I need to press Cmd-dot to continue. The interrupt reveals where the UI process was stuck:
Bug report
15 January 2024 5:45:40.243083 pm
VM: Win32 - Smalltalk
Image: Squeak6.1alpha [latest update: #22943]SecurityManager state:
Restricted: false
FileAccess: true
SocketAccess: true
Working Dir C:\Users\Christoph\OneDrive\Dokumente\Squeak
Trusted Dir C:\Users\Christoph\OneDrive\Dokumente\Squeak\Christoph
Untrusted Dir C:\Users\Christoph\OneDrive\Dokumente\My SqueakFullBlockClosure(BlockClosure)>>valueAndWaitWhileUnwinding:
Receiver: [closure] in [] in Process>>terminate
Arguments and temporary variables:
contextToUnwind: Context>>pop
semaphore: a Semaphore()
newBottom: FullBlockClosure(BlockClosure)>>ensure:
Receiver's instance variables:
outerContext: [] in Process>>terminate
startpcOrMethod: ([] in Process>>#terminate "a CompiledBlock(3245925)")
numArgs: 1
receiver: a Process(50758) in [] in Context>>unwindAndStop:[] in Process>>terminate
Receiver: a Process(50758) in [] in Context>>unwindAndStop:
Arguments and temporary variables:Receiver's instance variables: nextLink: nil suspendedContext: [] in Context>>unwindAndStop: priority: 40 myList: nil threadAffinity: nil effectiveProcess: nil name: nil island: nil env: a Dictionary()
FullBlockClosure(BlockClosure)>>ensure:
Receiver: [closure] in Process>>terminate
Arguments and temporary variables:
aBlock: [closure] in Process>>terminate
complete: true
returnValue: nil
Receiver's instance variables:
outerContext: Process>>terminate
startpcOrMethod: ([] in Process>>#terminate "a CompiledBlock(1088437)")
numArgs: 0
receiver: a Process(50758) in [] in Context>>unwindAndStop:Process>>terminate
Receiver: a Process(50758) in [] in Context>>unwindAndStop:
Arguments and temporary variables:Receiver's instance variables: nextLink: nil suspendedContext: [] in Context>>unwindAndStop: priority: 40 myList: nil threadAffinity: nil effectiveProcess: nil name: nil island: nil env: a Dictionary()
[] in ECMenuMorph>>postNarrow
Receiver: an ECMenuMorph(3220153)
Arguments and temporary variables:
p: a Process(50758) in [] in Context>>unwindAndStop:
Receiver's instance variables:
bounds: 759@582 corner: 1036@1017
owner: nil
submorphs: #()
fullBounds: 759@582 corner: 1036@1017
color: (Color r: 0.9 g: 0.9 b: 0.9)
extension: a MorphExtension (772249) [other: (borderStyle -> a SimpleBorder) (...etc...
selected: 1
firstVisible: 1
titleStringMorph: nil
controller: an ECBrowserController
context: an ECContext
pageHeight: 26
itemHeight: 16
detailMorph: nil
detailPosition: 1035@582
lastInteraction: 2024-01-15T17:30:29.192083+01:00
alpha: 0.0
processes: an OrderedCollection()OrderedCollection>>removeAllSuchThat:
Receiver: an OrderedCollection()
Arguments and temporary variables:
aBlock: [closure] in ECMenuMorph>>postNarrow
n: 1
index: 192
element: a Process(50758) in [] in Context>>unwindAndStop:
Receiver's instance variables:
array: #(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil ni...etc...
firstIndex: 1
lastIndex: 0ECMenuMorph>>postNarrow
Receiver: an ECMenuMorph(3220153)
Arguments and temporary variables:Receiver's instance variables: bounds: 759@582 corner: 1036@1017 owner: nil submorphs: #() fullBounds: 759@582 corner: 1036@1017 color: (Color r: 0.9 g: 0.9 b: 0.9) extension: a MorphExtension (772249) [other: (borderStyle -> a SimpleBorder) (...etc... selected: 1 firstVisible: 1 titleStringMorph: nil controller: an ECBrowserController context: an ECContext pageHeight: 26 itemHeight: 16 detailMorph: nil detailPosition: 1035@582 lastInteraction: 2024-01-15T17:30:29.192083+01:00 alpha: 0.0 processes: an OrderedCollection()
ECBrowserController(ECController)>>handleKeystrokeAfter:editor:
Receiver: an ECBrowserController
Arguments and temporary variables:
aKeyboardEvent: [170@179 keystroke 'n' (110) 138401125]
anEditor: a SmalltalkEditor
Receiver's instance variables:
model: a WeakArray(a TreeBrowser)
menuMorph: nil
editor: a WeakArray(a SmalltalkEditor)
context: nil
oppositeChar: nil
caret: nil
inverseMapping: nilECToolSet class>>codeCompletionAround:textMorph:keyStroke:
Receiver: ECToolSet
Arguments and temporary variables:
aBlock: [closure] in TextMorphForEditView(TextMorph)>>keyStroke:
aTextMorph: a TextMorphForEditView(491455)
evt: [170@179 keystroke 'n' (110) 138401125]
completionAllowed: true
editor: a SmalltalkEditor
stringHolder: a TreeBrowser
controller: an ECBrowserController
Receiver's instance variables:
superclass: StandardToolSet
methodDict: a MethodDictionary()
format: 0
instanceVariables: nil
organization: ('as yet unclassified')subclasses: nil name: #ECToolSet classPool: nil sharedPools: nil environment: Smalltalk category: #'Autocompletion-SqueakCompatibility'
ToolSet class>>codeCompletionAround:textMorph:keyStroke:
Receiver: ToolSet
Arguments and temporary variables:
aBlock: [closure] in TextMorphForEditView(TextMorph)>>keyStroke:
aTextMorph: a TextMorphForEditView(491455)
evt: [170@179 keystroke 'n' (110) 138401125]
Receiver's instance variables:
superclass: AppRegistry
methodDict: a MethodDictionary()
format: 0
instanceVariables: nil
organization: ('as yet unclassified')subclasses: nil name: #ToolSet classPool: nil sharedPools: nil environment: Smalltalk category: #'System-Applications' registeredClasses: an OrderedCollection(StandardToolSet CommandLineToolSet ECToolSet...etc... default: ECToolSet
TextMorphForEditView(TextMorph)>>keyStroke:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
evt: [170@179 keystroke 'n' (110) 138401125]
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
TextMorphForEditView>>keyStroke:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
evt: [170@179 keystroke 'n' (110) 138401125]
view: a PluggableTextMorphPlus(3139481)
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
TextMorphForEditView(Morph)>>handleKeystroke:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
anEvent: [170@179 keystroke 'n' (110) 138401125]
handler: a TextMorphForEditView(491455)
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
TextMorphForEditView(TextMorph)>>handleKeystroke:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
anEvent: [170@179 keystroke 'n' (110) 138401125]
pasteUp: nil
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
KeyboardEvent>>sentTo:
Receiver: [170@179 keystroke 'n' (110) 138401125]
Arguments and temporary variables:
anObject: a TextMorphForEditView(491455)
Receiver's instance variables:
timeStamp: 138401125
source: a HandMorph(333670)
type: #keystroke
buttons: 0
position: 170@179
handler: a TextMorphForEditView(491455)
wasHandled: true
wasIgnored: false
keyValue: 110
keyCode: 78TextMorphForEditView(Morph)>>handleEvent:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
anEvent: [170@179 keystroke 'n' (110) 138401125]
filteredEvent: [170@179 keystroke 'n' (110) 138401125]
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
TextMorphForEditView(Morph)>>handleFocusEvent:
Receiver: a TextMorphForEditView(491455)
Arguments and temporary variables:
anEvent: [170@179 keystroke 'n' (110) 138401125]
Receiver's instance variables:
bounds: 0@0 corner: 795@260
owner: a TransformMorph(1299609)
submorphs: #()
fullBounds: 0@0 corner: 795@260
color: Color black
extension: a MorphExtension (4182057) [other: (unfocusedSelectionColor -> (Col...etc...
borderWidth: 0
borderColor: Color black
textStyle: a TextStyle(6) Bitmap DejaVu Sans 10.5pt 96ppi 14px Normal
text: a Text for 'contentWithStyledProbabilities| confidentColor unconfident...etc... wrapFlag: true paragraph: a NewParagraph editor: a SmalltalkEditor container: nil predecessor: nil successor: nil backgroundColor: nil margins: 3@2 corner: 3@2 readOnly: false autoFit: true plainTextOnly: false numCharactersPerLine: nil editView: a PluggableTextMorphPlus(3139481) acceptOnCR: false
MorphicEventDispatcher>>doHandlingForFocusEvent:with:
Receiver: a MorphicEventDispatcher
Arguments and temporary variables:
currentEvent: [532@567 keystroke 'n' (110) 138401125]
focusMorph: a TextMorphForEditView(491455)
localEvent: [170@179 keystroke 'n' (110) 138401125]
filteredEvent: nil
Receiver's instance variables:
lastType: nil
lastDispatch: nilMorphicEventDispatcher>>dispatchFocusEvent:with:
Receiver: a MorphicEventDispatcher
Arguments and temporary variables:
anEventWithGlobalPosition: [532@567 keystroke 'n' (110) 138401125]
focusMorph: a TextMorphForEditView(491455)
currentEvent: [532@567 keystroke 'n' (110) 138401125]
Receiver's instance variables:
lastType: nil
lastDispatch: nil--- The full stack ---
FullBlockClosure(BlockClosure)>>valueAndWaitWhileUnwinding:
[] in Process>>terminate
FullBlockClosure(BlockClosure)>>ensure:
Process>>terminate
[] in ECMenuMorph>>postNarrow
OrderedCollection>>removeAllSuchThat:
ECMenuMorph>>postNarrow
ECBrowserController(ECController)>>handleKeystrokeAfter:editor:
ECToolSet class>>codeCompletionAround:textMorph:keyStroke:
ToolSet class>>codeCompletionAround:textMorph:keyStroke:
TextMorphForEditView(TextMorph)>>keyStroke:
TextMorphForEditView>>keyStroke:
TextMorphForEditView(Morph)>>handleKeystroke:
TextMorphForEditView(TextMorph)>>handleKeystroke:
KeyboardEvent>>sentTo:
TextMorphForEditView(Morph)>>handleEvent:
TextMorphForEditView(Morph)>>handleFocusEvent:
MorphicEventDispatcher>>doHandlingForFocusEvent:with:
MorphicEventDispatcher>>dispatchFocusEvent:with:
TextMorphForEditView(Morph)>>processFocusEvent:using:
TextMorphForEditView(Morph)>>processFocusEvent:
[] in [] in [] in HandMorph>>sendFocusEvent:to:clear:
[] in ActiveEventVariable class(DynamicVariable class)>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveEventVariable class(DynamicVariable class)>>value:during:
[] in ActiveEventVariable class>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveEventVariable class>>value:during:
KeyboardEvent(MorphicEvent)>>becomeActiveDuring:
[] in [] in HandMorph>>sendFocusEvent:to:clear:
[] in ActiveHandVariable class(DynamicVariable class)>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveHandVariable class(DynamicVariable class)>>value:during:
[] in ActiveHandVariable class>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveHandVariable class>>value:during:
HandMorph>>becomeActiveDuring:
[] in HandMorph>>sendFocusEvent:to:clear:
[] in ActiveWorldVariable class(DynamicVariable class)>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveWorldVariable class(DynamicVariable class)>>value:during:
[] in ActiveWorldVariable class>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveWorldVariable class>>value:during:
PasteUpMorph>>becomeActiveDuring:
HandMorph>>sendFocusEvent:to:clear:
HandMorph>>sendEvent:focus:clear:
HandMorph>>sendKeyboardEvent:
HandMorph>>handleEvent:
HandMorph>>processEvents
[] in [] in WorldState>>doOneCycleNowFor:
[] in ActiveHandVariable class(DynamicVariable class)>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveHandVariable class(DynamicVariable class)>>value:during:
[] in ActiveHandVariable class>>value:during:
FullBlockClosure(BlockClosure)>>ensure:
ActiveHandVariable class>>value:during:
HandMorph>>becomeActiveDuring:
[] in WorldState>>doOneCycleNowFor:
Array(SequenceableCollection)>>do:
WorldState>>handsDo:
-- and more not shown --
Exploring the receiver of the selected context in the first debugger (FullBlockClosure(BlockClosure)>>on:do:
) reveals the following stack (it is cyclic/infinite, I used self stackOfSize: 100
):
Exploring the contextToUnwind
from the interrupted context of the second debugger reveals the following (note the print-it displays the full stack of the interrupted context's receiver):
These are the methods from my package that are relevant to the bug (just look at the <--
pointer):
ECMenuMorph>>postNarrow
self selected: 0.
firstVisible := 1.
self model notEmpty ifTrue: [ self selected: 1 ].
(self model entries size < 4 and: [ self model expanded not])
ifTrue: ["Automatically expand if there are too few entries" self expand].
processes ifNotNil: [processes removeAllSuchThat: [:p | p terminate. true]]. "<-- here the process should be terminated"
processes ifNil: [processes := OrderedCollection new].
self model entries do: [:entry |
processes add: ([entry tryStorePredictedResultWith: context. self future changed] forkAt: Processor userBackgroundPriority)].
self show.
^ true
tryPredictResultWith: anECContext andDo: resultBlock
| controller editor code method result |
controller := anECContext instVarNamed: 'controller'.
editor := controller editor.
editor ifNil: [^ nil].
code := ((editor text first: editor startIndex - anECContext completionToken size - 1) , self completion) lines last.
method := [controller model doItContext class compilerClass new
compiledMethodFor: code
in: controller model doItContext
to: controller model doItReceiver
notifying: nil
ifFail: [^ nil]]
on: UndeclaredVariableNotification do: [:ex | ex resume] "prevent Transcript output" "<-- here an exception is resumed during parsing"
on: SyntaxErrorNotification do: [:ex | ^ nil].
result := [Sandbox evaluate:
[[(method
valueWithReceiver: controller model doItReceiver
arguments:
(controller model doItContext ifNil: [#()] ifNotNil: [:context | {context}]))
printString]
on: Error , Warning , Halt do: [:ex | ex]]]
valueWithin: 5 seconds onTimeout: [].
^ result ifNotNil: [resultBlock value: result]
To me, this looks as if the process was attempted to terminate while the UndeclaredVariableNotification
was on the stack (maybe while it was already being handled/resumed from), and something in the stack manipulation logic has prevented the termination from working correctly. Maybe this is related to the fact that the context stack is temporarily invalidated during Context class>>#contextEnsure:
et al. (cf. stepping into all the details of cut:
during thisContext insertSender: (Context contextEnsure: [])
)?
I wish I could reproduce this issue, but I cannot for now. I have a vague hope that this information might be enough to suggest any ideas of what might be wrong, and maybe create a simpler example to reproduce ...