Ravenbrook / Projects / Memory Pool System / Issues


MPS issue job002257

Title:MPS (diagnostic variety only) floating point exception after a collection
Status:closed
Priority:optional
Assigned user:Richard Kistruck
Organization:Ravenbrook
Description:MPS (diagnostic variety only) floating point exception after a collection

Normal varieties of MPS 1.109.1 are not affected by this issue.

The diagnostic variety of MPS 1.109.1 has extra code to report memory statistics after each collection. Occasionally, if there is nothing (or almost nothing) to collect, the code emitting this diagnostic information attempts to divide by zero, causing a crash. (Depending on the platform, this may be reported as "floating point exception", "arithmetic exception", "divide by zero", etc). The faulty code is only present in the diagnostic variety of MPS 1.109.1.
Analysis:RHSK 2010-03-29

Reproduce with master/...@170103; make -f xci3gc.gmk VARIETY=di zcoll; ./xci3gc/di/zcoll 670759320.

The faulty code is in arenavm.c/VMCompact(), inside a "DIAG(" block. So it is compiled-away in non-diagnostic varieties.

Fault:
  Size livePerc = live / (trace->condemned / 100);

Fix: check for zero before dividing!
How found:unknown
Evidence:Found by chance with test-runner. The magic of rnd().
Observed in:1.109.1
Introduced in:1.109.1
Created by:Richard Kistruck
Created on:2010‑03‑29 17:27:37
Last modified by:Richard Kistruck
Last modified on:2010‑11‑06 21:19:54
History:2010-03-29 RHSK Created.
2010-04-26 RHSK arenavm.c, not arena.c
2010-11-06 RHSK Optional not critical, because it is in diagnostic variety only, not shipped code.

Fixes

Change Effect Date User Description
170441 closed 2010‑04‑26 16:06:36 Richard Kistruck MPS br/vmem arenavm.c: (diagnostic variety only) fix floating point exception after a collection with 0 bytes condemned
The VMCompact diag was calculating the live percentage by dividing by condemned size. Don't do this if condemned is zero.

Generated at 2013-05-22 20:29:26 by $Id: //info.ravenbrook.com/infosys/cgi/issue.cgi#476 $

Copyright © Ravenbrook Limited. This document is provided "as is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this document. You may not duplicate or reproduce this document in any form without the express permission of the copyright holder.

Ravenbrook / Projects / Memory Pool System / Issues