pharo-contributions / taskit

TaskIt is a library that ease Process usage in Pharo. It provides abstractions to execute and synchronize concurrent tasks, and several pre-built mechanisms that are useful for many application developers.
MIT License
43 stars 24 forks source link

Error when debugging an error in a task in Pharo 7 #47

Closed girba closed 4 years ago

girba commented 5 years ago

Evaluate this:

[ 1/0 ] future onFailureDo: [ :ex | ex debug ]

==>

[ :contextHolder | 
contextHolder originalContext selector = #future
    and: [ contextHolder originalContext receiver isKindOf: TKTTask ] ] in TKTDebugSession>>filteredMasterStack in Block: [ :contextHolder | ...
[ :each | 
(aBlock value: each)
    ifTrue: [ ^ foundBlock cull: each ] ] in OrderedCollection(Collection)>>detect:ifFound:ifNone: in Block: [ :each | ...
OrderedCollection>>do:
OrderedCollection(Collection)>>detect:ifFound:ifNone:
OrderedCollection(Collection)>>detect:ifNone:
TKTRawProcessHolder>>findContextHolderSuchThat:
TKTDebugSession>>filteredMasterStack
TKTDebugSession>>filteredCombinedStack
TKTDebugSession>>stack
TKTDebugger(GTGenericStackDebugger)>>retrieveStackFrom:
[ :aSession | self retrieveStackFrom: aSession ] in TKTDebugger(GTGenericStackDebugger)>>stackWidgetIn: in Block: [ :aSession | self retrieveStackFrom: aSession ]
BlockClosure>>glamourValueWithArgs:
BlockClosure(ProtoObject)>>glamourValue:
GLMFastTablePresentation(GLMPresentation)>>displayValue
GLMFastTablePresentation(GLMListingPresentation)>>displayValue
GLMFastTableDataSource(GLMFastListDataSource)>>basicElements
[ self basicElements ] in GLMFastTableDataSource(GLMFastListDataSource)>>calculateElements in Block: [ self basicElements ]
OrderedCollection(Collection)>>ifEmpty:ifNotEmpty:
GLMFastTableDataSource(GLMFastListDataSource)>>calculateElements
GLMFastTableDataSource(GLMFastListDataSource)>>elements
GLMFastTableDataSource(FTSimpleDataSource)>>numberOfRows
FTTableMorph>>numberOfRows
FTTableContainerMorph>>calculateStartIndexWhenShowing:
FTTableContainerMorph>>updateExposedRows
FTTableMorph>>resetPosition
FTTableMorph>>dataSource:
GLMMorphicFastTableRenderer(GLMMorphicFTRenderer)>>initializeTableMorph
GLMMorphicFastTableRenderer(GLMMorphicFTRenderer)>>render:
GLMMorphicFastTableRenderer class(GLMMorphicWidgetRenderer class)>>render:from:
girba commented 5 years ago

The simplest solution is to unregister the debugger. However, it would still be useful to try to salvage it. Perhaps @theseion can have input on it?

theseion commented 5 years ago

What do I need to do? Install TaskIT2 from the catalog?

girba commented 5 years ago

Thanks for looking at it! In a Pharo 7, run this:

Metacello new
    baseline: 'TaskIt';
    repository: 'github://sbragagnolo/taskit:v1.0.1';
    load.

[ 1/0 ] future onFailureDo: [ :ex | ex debug ]
theseion commented 5 years ago

Well, I can see that this builds on my code but they use weak references to the original process and its contexts, which is exactly what you mustn't do if you intend to have access to it later in the debugger. This is an architectural issue in TaskIt and not simple to fix.

girba commented 5 years ago

Ok, then is it better to simply not use the dedicated debugger?

theseion commented 5 years ago

Yes, I think so. At least until that problem has been fixed.

BTW, I just checked my original implementation and I really did use hard references. I guess they tried to prevent garbage accumulation.

guillep commented 5 years ago

I'm not 100% into the issue, but I know in the past Taskit we worked a lot on avoiding memory leaks. The problem is that a leaking reference to a context/process will leak tons of objects. This is also produced by leaing blocks.

sbragagnolo commented 4 years ago

fixed