Skip to content

testing: parallel fuzzing hangs with -parallel=1 #50217

Description

@AlekSi
go version devel go1.18-7f2314530e Thu Dec 16 00:34:10 2021 +0000 darwin/arm64

The following test hangs when run with go test -parallel=1:

func FuzzParallel(f *testing.F) {
	f.Add(42)

	f.Fuzz(func(t *testing.T, i int) {
		t.Parallel()
	})
}

It works with -parallel=2 and other values. I think it should work in any case.

Small self-contained example is there: https://github.com/AlekSi/go-bug/tree/master/50217

Activity

  1. AlekSi commented on Dec 16, 2021

    @AlekSi
    Author
  2. added
    fuzzIssues related to native fuzzing support
    on Dec 16, 2021
  3. AlekSi commented on Dec 16, 2021

    @AlekSi
    ContributorAuthor

    Bisected down to b2b6be7

  4. cherrymui commented on Dec 16, 2021

    @cherrymui
    Member

    cc @golang/fuzzing

  5. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Dec 16, 2021
  6. added this to the Go1.18 milestone on Dec 16, 2021
  7. rolandshoemaker commented on Dec 16, 2021

    @rolandshoemaker
    Member

    This seems like one of the things that should just be disabled, both within the f.Fuzz function, and disallowing the flag, since I'm not really sure what it would do. @katiehockman what do you think?

  8. thepudds commented on Dec 17, 2021

    @thepudds
    Member

    FWIW, in terms of what it could do, the design doc includes:

    // Run the fuzz test
    f.Fuzz(func(t *testing.T, a string, num *big.Int) {
    	t.Parallel() // seed corpus tests can run in parallel
    

    Certainly seems reasonable to disallow it though, especially for a first version.

  9. AlekSi commented on Dec 17, 2021

    @AlekSi
    ContributorAuthor

    Running seed corpus entries in parallel actually works (as far as I can tell) and is very useful for me. If there is not enough time to fix it for -parallel=1 edge case, maybe just explicitly fail in that case instead of hanging or removing the whole feature.

  10. katiehockman commented on Dec 20, 2021

    @katiehockman
    Contributor

    t.Parallel() in a fuzz target should be a no-op during fuzzing, but is similar to a t.Parallel() inside a t.Run() in that it runs the seed corpus in parallel when -fuzz isn't set.
    This is just a bug I think. If we can't fix it, then just removing that functionality for 1.18 also seems fine. Will take a look.

  11. self-assigned this
    on Dec 20, 2021
  12. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    and removed
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Dec 20, 2021
  13. gopherbot commented on Dec 22, 2021

    @gopherbot
    Contributor

    Change https://golang.org/cl/374054 mentions this issue: testing: fix deadlock with t.Parallel in testing seed corpus

  14. added a commit that references this issue on Jun 21, 2022
    b2f067e
  15. locked and limited conversation to collaborators on Jun 22, 2023
  16. added a commit that references this issue on Sep 19, 2024
    b9cae6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.fuzzIssues related to native fuzzing support

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions