pingcap / failpoint

An implementation of failpoints for Golang.
Apache License 2.0
817 stars 63 forks source link

Failpoint doesn't work when Inject function defined in a closure argument #70

Closed sleepymole closed 2 years ago

sleepymole commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.

    f := func(g func() error) {}
    f(func() error {
        failpoint.Inject("XXX", func() {
            failpoint.Return(errors.New("mock error"))
        })
        return nil
    })
  2. What did you expect to see? After enabled failpoint,failpoint.Inject can be changed to failpoint.Eval.

  3. What did you see instead?

Nothing changed

  1. Versions of the failpoint

    • failpoint-ctl version (run failpoint-ctl -V): The version comes from tidb's go.mod
      v0.0.0-20200702092429-9f69995143ce