Commit cd54d0f
Fix flaky TestGc#test_stat_single by disabling GC
test_stat_single fails intermittently:
1) Failure:
TestGc#test_stat_single [test/ruby/test_gc.rb:198]:
<12> expected but was
<13>.
The test reads the full GC.stat hash and then GC.stat(:count) separately
and asserts they are equal:
stat = GC.stat
assert_equal stat[:count], GC.stat(:count)
These are two separate reads of :count. If a GC runs between them, :count
increases and the reads disagree (stat[:count] < GC.stat(:count)). A GC in
that window can be triggered by an allocation on another thread; running
the two reads in a loop with a background allocating thread reproduces it
deterministically (54/2,000,000 mismatches; 0 after the fix).
The exact source of the GC in the failing CI run is unclear (test-all runs
each test process independently), so rather than chase the trigger, disable
GC around the two reads (matching test_stat_heap etc.) so :count cannot
change between them.
CI: https://ci.rvm.jp/results/trunk@ruby-sp3/6395611
log: https://ci.rvm.jp/logfiles/brlog.trunk.20260629-050802
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8e6fd8f commit cd54d0f
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
| |||
0 commit comments