-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixing WaitGroup related panics in the Go SDK #7661
Conversation
Discussion on possible approaches to fix this:
|
Copying from the ticket the minimal Go program that helped me understand when/why Go runtime throws a panic:
Note that unfortunately the panic is attributed to |
Oof. This is pretty bad. Aside from the panic, this provides an easy route for asynchronous work to go untracked. One thing we could consider to ameliorate the problem of untracked asynchronous work is the addition of a fast path in
This seems like the best way to resolve the panic. I think that if we do not want to refactor, we will need to atomically swap in a new |
Ok let me try something along these lines. |
@pgavlin PTAL.. Catching/recovering from panics on Because of this, I rolled our own version of Unfortunately this does not discriminate between the use for I'd tackle fast-path for ApplyT in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, this seems reasonable to me. Thanks for the tests here!
`time.Sleep(10)` is perceived as a bug because there's no unit. If the author was coming from another programming language they could have meant milliseconds or seconds (unlikely). Make the nanosecond unit explicit. Issue caught by staticcheck: ``` go/pulumi/context_test.go:93:14: SA1004: sleeping for 10 nanoseconds is probably a bug; be explicit if it isn't (staticcheck) ``` Refs #7661 Refs #11808
`time.Sleep(10)` is perceived as a bug because there's no unit. If the author was coming from another programming language they could have meant milliseconds or seconds (unlikely). Make the nanosecond unit explicit. Issue caught by staticcheck: ``` go/pulumi/context_test.go:93:14: SA1004: sleeping for 10 nanoseconds is probably a bug; be explicit if it isn't (staticcheck) ``` Refs #7661 Refs #11808
11868: sdk/context/test: Explicitly sleep for 10 nanoseconds r=abhinav a=abhinav `time.Sleep(10)` is perceived as a bug because there's no unit. If the author was coming from another programming language they could have meant milliseconds or seconds (unlikely). Make the nanosecond unit explicit. Issue caught by staticcheck: ``` go/pulumi/context_test.go:93:14: SA1004: sleeping for 10 nanoseconds is probably a bug; be explicit if it isn't (staticcheck) ``` Refs #7661 Refs #11808 --- I'm not sure if this was actually intended to be nanoseconds. The test still passes with milliseconds and microseconds, although with milliseconds it takes a lot longer because of the many iterations. CC `@t0yv0,` in case you remember the unit you wanted here. Co-authored-by: Abhinav Gupta <[email protected]>
Description
Fixes #7275
Checklist