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

TKTService recursive approach probably leads to infinite context chains #26

Closed dionisiydk closed 4 years ago

dionisiydk commented 7 years ago

Recursion is defined here:

 TKTService>>scheduleRecursiveTask
    stopRequested
        ifTrue: [ worker schedule: [ self doStop ] ]
        ifFalse: [
            worker schedule: [ 
                self stepService.
                self scheduleRecursiveTask ]]

While #schedule: message not immediately evaluates given block it will still instantiate block closure with outer context reference. It means that every service step will produce extra context reference up to first "stepService" block. And if service is constantly lived task then at some point memory will ends.

dionisiydk commented 7 years ago

Possible fix is to represent this blocks as concrete TKTTask instances

sbragagnolo commented 4 years ago

Sorry for the long long long delay :D . we are using a sameblock policy. :)

sbragagnolo commented 4 years ago

Sorry for the long long long delay :D . we are using a sameblock policy. :)