• Russ Cox's avatar
    runtime: fix finalizer flakiness · 241f63de
    Russ Cox authored
    The flakiness appears to be just in tests, not in the actual code.
    Specifically, the many tests call runtime.GC once and expect that
    the finalizers will be running in the background when GC returns.
    Now that the sweep phase is concurrent with execution, however,
    the finalizers will not be run until sweep finishes, which might
    be quite a bit later. To force sweep to finish, implement runtime.GC
    by calling the actual collection twice. The second will complete the
    sweep from the first.
    
    This was reliably broken after a few runs before the CL and now
    passes tens of runs:
    
    while GOMAXPROCS=2 ./runtime.test -test.run=Finalizer -test.short \
            -test.timeout=300s -test.cpu=$(perl -e 'print ("1,2,4," x 100) . "1"')
    do true; done
    
    Fixes #7328.
    
    LGTM=dvyukov
    R=dvyukov, dave
    CC=golang-codereviews
    https://golang.org/cl/71080043
    241f63de
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
liblink Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...