• 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
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...