Skip to content

[dev.fuzz] cmd/go: fuzzing can sometimes print both "PASS" and "FAIL" #46969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
katiehockman opened this issue Jun 29, 2021 · 2 comments
Closed
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@katiehockman
Copy link
Contributor

I was playing around with the fuzz target in #46632, and noticed a bug.

~ go test internal/fuzz -v -run=None -fuzz=FuzzCleanup
=== FUZZ  FuzzCleanup
fuzzing, elapsed: 3.0s, execs: 8 (3/sec), workers: 8, interesting: 1
fuzzing, elapsed: 6.0s, execs: 32 (5/sec), workers: 8, interesting: 1
<pressed Ctrl+C>
--- PASS: FuzzCleanup (7.08s)
PASS
ok      internal/fuzz   7.238s
FAIL

Note that the go command says that FuzzCleanup passed, but the last line says FAIL. I'm guessing there's a race or something going on, since this only happens occasionally, and I haven't figured out how to reproduce this consistently.

This was the target I used (from #46632):

func FuzzCleanup(f *testing.F) {
	var mu sync.Mutex
	var cleaned bool
	f.Cleanup(func() {
		mu.Lock()
		cleaned = true
		mu.Unlock()
	})
	f.Add([]byte("abc"))
	f.Fuzz(func(t *testing.T, data []byte) {
		time.Sleep(time.Second)
		mu.Lock()
		defer mu.Unlock()
		if cleaned {
			panic("Cleanup called before fuzzing finished.")
		}
	})
}

/cc @golang/fuzzing

@katiehockman katiehockman added NeedsFix The path to resolution is known, but the work has not been done. fuzz Issues related to native fuzzing support labels Jun 29, 2021
@katiehockman
Copy link
Contributor Author

This will likely be a release blocker for Go 1.18

@katiehockman katiehockman added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsFix The path to resolution is known, but the work has not been done. labels Sep 14, 2021
@katiehockman katiehockman added this to the Go1.18 milestone Sep 14, 2021
@katiehockman
Copy link
Contributor Author

Same as #46993 - I'm not able to reproduce this, anymore. I wouldn't be surprised if it got fixed along the way in our several refactors. I'm going to close this issue, but we can re-open it if users run into it.

@golang golang locked and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge fuzz Issues related to native fuzzing support NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
Status: No status
Development

No branches or pull requests

2 participants