Mantis - Squeak
Viewing Issue Advanced Details
1041 Kernel minor N/A 04-04-05 19:26 12-20-05 15:17
none 3.9  
0001041: [VM][ENH] LowSpaceAndInterruptHandler-dtl
David T. Lewis <>:

"These change sets are updates to the VM and to the low space watcher that
fix low space interrupt handling and user interrupt handling in Morphic.

Under certain conditions the low space watcher was unable to determine the
correct process to suspend following a low space signal. These changes permit
the VM to remember the identity of the process that caused the low space
condition, and to report it to the image through a primitive.

The low space watcher changes are backward compatible for use with VMs
that do not yet have the new primitive (i.e. broken the same way as was
the case in Squeak 3.7).

- This is done with VMMaker 3-8b2, hence is not updated for 64 bit VM.
- I added a numbered primitive, which is probably a bad thing (but I'm not
  sure where best to put it, possibly MiscPrimitivePlugin?).
- There may be a simpler way to accomplish this, but at least this is a
  working implementation.
- I have not tested the interpreter simulator, still need to make sure I did
  not break it.

Cross posted to vm-dev and squeak-dev. Follow-ups should go to vm-dev
(unless someone can think of a way to handle this properly without
touching the VM)."
related to 0001070closed tim Major holes in VM space security 
child of 0007655new  A mother for user interupt bugs and problems 
 VMMLowSpaceAndInterruptHandler-dtl.cs.gz [^] (5,460 bytes) 04-04-05 19:26
 LowSpaceAndInterruptHandler-dtl.cs.gz [^] (2,012 bytes) 04-04-05 19:27
 LowSpaceAndInterruptHandlerMVC-dtl.cs.gz [^] (1,767 bytes) 04-10-05 20:40
 LowSpaceAndInterruptHandler-2-dtl.cs.gz [^] (3,016 bytes) 04-16-05 06:43
 VMMLowSpaceAndInterruptHandler-2-dtl.cs.gz [^] (3,300 bytes) 04-16-05 06:43
 LowSpaceAndInterruptHandler-3-dtl.1.cs.gz [^] (3,110 bytes) 10-05-05 01:24

04-10-05 20:46   
I added LowSpaceAndInterruptHandlerMVC-dtl.cs.gz, which adds low space and interrupt key handling for MVC. This should be loaded after LowSpaceAnddInterruptHandler-dtl. With the additional change set (and with the VM rebuilt), Squeak MVC and Morphic pass the four Andreas tests for interruptability:

  * "[true] whileTrue"
  * "[[true] whileTrue] forkAt: Processor userSchedulingPriority + 1"
  * "Smalltalk createStackOverflow"
  * "[Smalltalk createStackOverflow] forkAt: Processor userSchedulingPriority + 1"

This also corrects the previously unreported problem of not being able to interrupt a high priority background process in MVC (test 2 above), which goes back to at least Squeak 3.6.
04-13-05 03:21   
See also 1070.

I think we can report the culprit process oop more easily (and the oop rather than the hash) via the specialObjectArray. Element 23 is unused for example so we don't even have to increase the size really.

Is it really a good idea to discover there is a lowspace situation and go on to allocate a possibly large object anyway?
04-13-05 09:58   
That's a wonderful idea! I had been worrying about this myself but sticking it into the splObjs would be the way to go. I'm all for it.
04-13-05 14:01   
Probably obvious, but note that as a safety check it is a good idea to make sure the saved oop is saved once and only once, then cleared by the low space watcher. Otherwise, if the low space watcher does anything to allocate a chunk prior to obtaining the saved oop, you get the wrong value. This does not actually happen in practice (why would someone allocate memory in a low space handler), but if it ever did we would have another obscure deferred-crash bug.
04-16-05 06:47   
Tim suggested that the process causing the low space condition could be passed back to the image in the special objects array, rather than passing the identity hash via a primitive. An implemention is provided in these two change sets:

  LowSpaceAndInterruptHandler-2-dtl - image side changes for Morphic and MVC
  VMMLowSpaceAndInterruptHandler-2-dtl - VM changes
05-15-05 06:23   
A slight variation (to make it 64bit clean etc) of this is in the upcoming VMMaker release. It assists the selection of the right process to debug and makes things a bit more reliable in Squeak.

In systems with many processes though I doubt that it can make much difference since one can easily imagine that a greedy process is chewing up memory like it was out of fashion, a dainty little high priority process triggers, just barely pushes the lowspace limit and gets to be the guilty party. Meanwhile Mr Greedy doesn't get his hand slapped and and continue on.

Mr UpdateManager -
The LowSpaceAndInterruptHandler-2-dtl-cs.gz needs to be added to the update stream to make use of the new VM parts.
09-30-05 09:34   
needs to be added to 3.9
10-04-05 16:42   
the cs are outdated.
David did another one
10-05-05 01:33   
Stef asked me to check LowSpaceAndInterruptHandler-2-dtl for conflicts before he added it to the update stream. Good call; there were some bit rot issues.

I have uploaded LowSpaceAndInterruptHandler-3-dtl, which replaces LowSpaceAndInterruptHandler-2-dtl for Squeak3.9a-6693. This change set differs from LowSpaceAndInterruptHandler-2-dtl in the #lowSpaceWatcher and #recreateSpecialObjectsArray methods, both of which had changed in Squeak3.9a-6693 since the original LowSpaceAndInterruptHandler-2-dtl was done.

LowSpaceAndInterruptHandler-3-dtl has the fixes for both MVC and Morphic. Tim has put the VMMaker changes into VMM already. Therefore LowSpaceAndInterruptHandler-3-dtl is the only change set that needs to be added to the update stream.

This is a sensitive change, so I would appreciate if at least one qualified person can double-check it before it gets applied to the update stream.
10-05-05 23:22   
It loads and seems to function ok in a 3.9a image on a mac. Looks good to me - passes the four tests ok.
10-05-05 23:34   
Tested on a VMM3.8-64bit VM on RISC OS as well and works just fine.
12-20-05 15:17   
6707 finally :)
I hope that this is ok and I did not mess up something