MPS issue job002257

TitleMPS (diagnostic variety only) floating point exception after a collection
Statusclosed
Priorityoptional
Assigned userRichard Kistruck
OrganizationRavenbrook
DescriptionMPS (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.
AnalysisRHSK 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 foundunknown
EvidenceFound by chance with test-runner. The magic of rnd().
Observed in1.109.1
Introduced in1.109.1
Created byRichard Kistruck
Created on2010-03-29 17:27:37
Last modified byRichard Kistruck
Last modified on2010-11-06 21:19:54
History2010-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.