[Pharo-project] Another finalization concern: error handling

Igor Stasenko siguctua at gmail.com
Mon Oct 11 07:40:42 EDT 2010


here a situation, with which we can deal in more safer manner:

Suppose you have a weak registry, populated by different objects and
their executors.

Now, when some of them died, a weak registry performs finalization.

The potential danger is , that if there's an error triggered by some
then rest of executors will have no chance to run and will be
forgotten, causing memory leakage.

What you think, should we handle this more graciously?

(Consider a following meta-code)

| executors |
  executors := self gatherExecutorsToRun.

  executors do: [:ex |
     [ ex finalize ] fork.

in this way, if any executor's #finalize causing error, it won't
interfere with other executors, and they will accomplish their task
Of course, i'm not saying that we should use #fork for this, because
it is costly. Similar could be done w/o forking.
I just wanted to show a simplest code with which we could achieve a
more gracious error handling.

P.S. of course, in a first place it would be good to make sure that we
writing executors, which can't cause an error during finalization.
But bad things happen, and we should make sure that rest of system
won't be put on its knees because of some stupid bug in a single

Best regards,
Igor Stasenko AKA sig.

More information about the Pharo-dev mailing list