Worked around a deadlock in FlushFSTest.Mmap.

geesefs-0-30-9
Aaron Jacobs 2015-03-23 11:16:39 +11:00
parent 68a8062681
commit 2728137e7d
1 changed files with 13 additions and 0 deletions

View File

@ -573,6 +573,19 @@ func (t *FlushFSTest) Mmap() {
var n int
var err error
// If we run this test with GOMAXPROCS=1 (the default), the program will
// deadlock for the reason described here:
//
// https://groups.google.com/d/msg/golang-nuts/11rdExWP6ac/TzwT6HBOb3wJ
//
// In summary, the goroutine reading from the mmap'd file is camping on a
// scheduler slot while it blocks on a page fault, and the goroutine handling
// fuse requests is waiting for the scheduler slot.
//
// So run with GOMAXPROCS=2.
old := runtime.GOMAXPROCS(2)
defer runtime.GOMAXPROCS(old)
// Open the file.
t.f1, err = os.OpenFile(path.Join(t.Dir, "foo"), os.O_RDWR, 0)
AssertEq(nil, err)