From 2d00007bdb996dc859ffb16b601e0f51bb72662c Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 17 Dec 2018 20:57:34 -0500 Subject: runtime: flush on every write barrier while debugging Currently, we flush the write barrier buffer on every write barrier once throwOnGCWork is set, but not during the mark completion algorithm itself. As seen in recent failures like https://build.golang.org/log/317369853b803b4ee762b27653f367e1aa445ac1 by the time we actually catch a late gcWork put, the write barrier buffer is full-size again. As a result, we're probably not catching the actual problematic write barrier, which is probably somewhere in the buffer. Fix this by using the gcWork pause generation to also keep the write barrier buffer small between the mark completion flushes it and when mark completion is done. For #27993. Change-Id: I77618169441d42a7d562fb2a998cfaa89891edb2 Reviewed-on: https://go-review.googlesource.com/c/154638 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox Reviewed-by: Michael Knyszek --- src/runtime/mgc.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/runtime/mgc.go') diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 36d48d2561..9d21dc4fa0 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -1434,6 +1434,7 @@ top: if debugCachedWork { b := &_p_.wbBuf b.end = uintptr(unsafe.Pointer(&b.buf[wbBufEntryPointers])) + b.debugGen = gcWorkPauseGen } // Flush the gcWork, since this may create global work // and set the flushedWork flag. -- cgit v1.2.1