You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across another interesting behaviour difference compared to golang.org/x/sync/errgroup: It's possible for functions given to Go() to never be run.
This can happen, I believe, if a worker goroutine encounters an error (such as a context cancellation) and then returns (in the goroutine in startG()). Then in Wait(), since our only condition to stop is waiting on the waitgroup, we end up setting qCh to nil and returning. This could leave messages in qCh that never get seen.
golang.org/x/sync/errgroup on the other hand will always run a goroutine given to Go().
It would be pretty racey to cause and I haven't reproduced it, but I encountered an issue with a service I have where it assumes a function must be run, even if it's going to error.
I'm not sure what the best thing to do is however. If there's been an error, should we bother trying to run any queued functions? I'm not sure. But perhaps so since it would be a difference compared to what golang.org/x/sync/errgroup does.
The text was updated successfully, but these errors were encountered:
@horgh Apologies for the radio silence, it was a summer off open-source work.
I'm not sure what the best thing to do is however.
I'm not quite sure either. Between this and the previous issues you've raised, I wonder if the goal of "identical behavior to sync/errgroup" is achievable. Unfortunately I haven't been able to devote the time to look into those issues in detail (the package has worked well enough for the use cases I had, which are more trivial than yours). But if you've been able to make headway on those topics, I'd love to see a PR (even if partial).
Hi agai!. Sorry to be opening so many issues :-P.
I came across another interesting behaviour difference compared to
golang.org/x/sync/errgroup
: It's possible for functions given toGo()
to never be run.This can happen, I believe, if a worker goroutine encounters an error (such as a context cancellation) and then returns (in the goroutine in
startG()
). Then inWait()
, since our only condition to stop is waiting on the waitgroup, we end up settingqCh
tonil
and returning. This could leave messages inqCh
that never get seen.golang.org/x/sync/errgroup
on the other hand will always run a goroutine given toGo()
.It would be pretty racey to cause and I haven't reproduced it, but I encountered an issue with a service I have where it assumes a function must be run, even if it's going to error.
I'm not sure what the best thing to do is however. If there's been an error, should we bother trying to run any queued functions? I'm not sure. But perhaps so since it would be a difference compared to what
golang.org/x/sync/errgroup
does.The text was updated successfully, but these errors were encountered: