-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
The time tests seem flaky on OpenBSD for some reason. E.g., recent-ish time.TestAfterQueuing failures on openbsd/amd64:
http://build.golang.org/log/7cf643d530ccbe39c97376ffdb2af64db66bcb5d
http://build.golang.org/log/10a9c8a1ffc2a088f48a12fdc9379f91a8bbc8b8
http://build.golang.org/log/702430fd8bf22805d19672d0795f6bc0d1395e6b
http://build.golang.org/log/cb50ea140b06232bdecb4c926134c9113f94e56a
Here's a time.TestReset failure on openbsd/amd64:
http://build.golang.org/log/26bb60d01823523470ffe47c7ed5fa9cdb280513
Flakiness has been seen on openbsd/386 in the past too; e.g.
http://build.golang.org/log/bd19f8590db8c7f317b3f968ac1af5126f5449cf
I've previously conjectured that this could be related to random scheduling delays interacting with repeated absolute<->relative timeout conversions in package runtime, but after measuring this seems unlikely (see https://groups.google.com/d/msg/golang-dev/AbSUgOucZyk/6ea0yP3ba1QJ).
It's possible this is actually an OpenBSD kernel issue. One conjecture I have at the moment is that the tc_windup() function (http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/kern/kern_tc.c) is not multiprocessor safe, because it doesn't use proper memory barriers. E.g., the final "timehands = th;" assignment might become visible to another thread before the modifications to the struct timehands's fields become visible.
Aside: I pointed this out privately to PHK in 2010, to which he responded "You are probably right, explicit memory barriers are probably called for." but FreeBSD still does not use memory barriers in tc_windup() either as far as I can tell: https://github.com/freebsd/freebsd/blob/master/sys/kern/kern_tc.c
NetBSD appears to have added explicit memory barriers back in 2007: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_tc.c#rev1.20