[sync] x/sync/errgroup: make note of the default errgroup goroutine limit (unlimited)

231 views
Skip to first unread message

Jean de Klerk (Gerrit)

unread,
Jun 1, 2022, 10:20:35 AM6/1/22
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Jean de Klerk has uploaded this change for review.

View Change

x/sync/errgroup: make note of the default errgroup goroutine limit (unlimited)

This is a question in the form of a CL. If I'm right about my guess, yay! If
not, I'll change the answer. Either way, we should document it.

Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
---
M errgroup/errgroup.go
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/errgroup/errgroup.go b/errgroup/errgroup.go
index 1eab2fd..da2d40d 100644
--- a/errgroup/errgroup.go
+++ b/errgroup/errgroup.go
@@ -113,7 +113,7 @@
}

// SetLimit limits the number of active goroutines in this group to at most n.
-// A negative value indicates no limit.
+// A negative value indicates no limit. The default is unlimited.
//
// Any subsequent call to the Go method will block until it can add an active
// goroutine without exceeding the configured limit.

To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: sync
Gerrit-Branch: master
Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
Gerrit-Change-Number: 409774
Gerrit-PatchSet: 1
Gerrit-Owner: Jean de Klerk <dek...@google.com>
Gerrit-MessageType: newchange

Jean de Klerk (Gerrit)

unread,
Jun 1, 2022, 10:21:26 AM6/1/22
to goph...@pubsubhelper.golang.org, Changkun Ou, Bryan Mills, golang-co...@googlegroups.com

Attention is currently required from: Bryan Mills, Changkun Ou.

Patch set 1:Run-TryBot +1

View Change

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 1
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:21:22 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Changkun Ou (Gerrit)

    unread,
    Jun 1, 2022, 10:41:25 AM6/1/22
    to Jean de Klerk, goph...@pubsubhelper.golang.org, Gopher Robot, Bryan Mills, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Jean de Klerk.

    View Change

    1 comment:

    • File errgroup/errgroup.go:

      • Patch Set #1, Line 116: default

        I don't know what "default" means here. Is default referring to `SetLimit(0)`?

        I think we might want to clarify the difference between SetLimit is never called or called with a given number. But this clarification shouldn't be here.

        Suppose we want to clarify SetLimit(0). In that case, it seems to me that the existing doc already covered all behavior: SetLimit(0) means "SetLimit limits the number of active goroutines in this group to at most 0."

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 1
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Jean de Klerk <dek...@google.com>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:41:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Bryan Mills (Gerrit)

    unread,
    Jun 1, 2022, 10:47:50 AM6/1/22
    to Jean de Klerk, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Changkun Ou, golang-co...@googlegroups.com

    Attention is currently required from: Changkun Ou, Jean de Klerk.

    Patch set 1:Code-Review +1

    View Change

    1 comment:

    • File errgroup/errgroup.go:

      • I don't know what "default" means here. Is default referring to `SetLimit(0)`? […]

        From the commit message, I'm guessing that this refers to the behavior if `SetLimit` is not called.

        In that case, perhaps we should update the comment on line 20 instead:

        ```
        // A zero Group is valid, has no limit on the number of active goroutines,
        // and does not cancel on error.
        ```

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 1
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Attention: Jean de Klerk <dek...@google.com>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:47:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Changkun Ou <ma...@changkun.de>
    Gerrit-MessageType: comment

    Jean de Klerk (Gerrit)

    unread,
    Jun 1, 2022, 10:51:06 AM6/1/22
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Changkun Ou, Jean de Klerk.

    Jean de Klerk uploaded patch set #2 to this change.

    View Change

    The following approvals got outdated and were removed: Run-TryBot+1 by Jean de Klerk, TryBot-Result+1 by Gopher Robot

    x/sync/errgroup: make note of the default errgroup goroutine limit (unlimited)

    Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    ---
    M errgroup/errgroup.go
    1 file changed, 10 insertions(+), 1 deletion(-)

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Attention: Jean de Klerk <dek...@google.com>
    Gerrit-MessageType: newpatchset

    Jean de Klerk (Gerrit)

    unread,
    Jun 1, 2022, 10:51:17 AM6/1/22
    to goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Changkun Ou, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Changkun Ou.

    View Change

    1 comment:

    • File errgroup/errgroup.go:

      • From the commit message, I'm guessing that this refers to the behavior if `SetLimit` is not called. […]

        Done

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 2
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:51:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Bryan Mills <bcm...@google.com>

    Jean de Klerk (Gerrit)

    unread,
    Jun 1, 2022, 10:52:51 AM6/1/22
    to goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Changkun Ou, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Changkun Ou.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #3:

        errr, sorry, having trouble uploading. one moment...

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 3
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:52:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Jean de Klerk (Gerrit)

    unread,
    Jun 1, 2022, 10:53:10 AM6/1/22
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Changkun Ou.

    Jean de Klerk uploaded patch set #4 to this change.

    View Change

    x/sync/errgroup: make note of the default errgroup goroutine limit (unlimited)


    Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    ---
    M errgroup/errgroup.go
    1 file changed, 11 insertions(+), 1 deletion(-)

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 4
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-MessageType: newpatchset

    Jean de Klerk (Gerrit)

    unread,
    Jun 1, 2022, 10:53:26 AM6/1/22
    to goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, Changkun Ou, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Changkun Ou.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #3:

        errr, sorry, having trouble uploading. one moment...

      • there we go - done properly now =)

    To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: sync
    Gerrit-Branch: master
    Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
    Gerrit-Change-Number: 409774
    Gerrit-PatchSet: 4
    Gerrit-Owner: Jean de Klerk <dek...@google.com>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Changkun Ou <ma...@changkun.de>
    Gerrit-Comment-Date: Wed, 01 Jun 2022 14:53:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Jean de Klerk <dek...@google.com>
    Gerrit-MessageType: comment

    Changkun Ou (Gerrit)

    unread,
    Jun 1, 2022, 10:54:19 AM6/1/22
    to Jean de Klerk, goph...@pubsubhelper.golang.org, Bryan Mills, Gopher Robot, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Jean de Klerk.

    Patch set 4:Run-TryBot +1Code-Review +1

    View Change

      To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: sync
      Gerrit-Branch: master
      Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
      Gerrit-Change-Number: 409774
      Gerrit-PatchSet: 4
      Gerrit-Owner: Jean de Klerk <dek...@google.com>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Jean de Klerk <dek...@google.com>
      Gerrit-Comment-Date: Wed, 01 Jun 2022 14:54:14 +0000

      Bryan Mills (Gerrit)

      unread,
      Jun 1, 2022, 10:54:30 AM6/1/22
      to Jean de Klerk, goph...@pubsubhelper.golang.org, Bryan Mills, Changkun Ou, Gopher Robot, golang-co...@googlegroups.com

      Attention is currently required from: Jean de Klerk.

      Patch set 4:Run-TryBot +1Code-Review +2

      View Change

        To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: sync
        Gerrit-Branch: master
        Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
        Gerrit-Change-Number: 409774
        Gerrit-PatchSet: 4
        Gerrit-Owner: Jean de Klerk <dek...@google.com>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
        Gerrit-Attention: Jean de Klerk <dek...@google.com>
        Gerrit-Comment-Date: Wed, 01 Jun 2022 14:54:27 +0000

        Jean de Klerk (Gerrit)

        unread,
        Jun 1, 2022, 11:02:21 AM6/1/22
        to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Gopher Robot, Bryan Mills, Changkun Ou, golang-co...@googlegroups.com

        Jean de Klerk submitted this change.

        View Change


        Approvals: Bryan Mills: Looks good to me, approved; Run TryBots Changkun Ou: Looks good to me, but someone else must approve; Run TryBots Gopher Robot: TryBots succeeded
        x/sync/errgroup: make note of the default errgroup goroutine limit (unlimited)

        Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
        Reviewed-on: https://go-review.googlesource.com/c/sync/+/409774
        Run-TryBot: Bryan Mills <bcm...@google.com>
        Reviewed-by: Bryan Mills <bcm...@google.com>
        Reviewed-by: Changkun Ou <ma...@changkun.de>
        Run-TryBot: Changkun Ou <ma...@changkun.de>
        TryBot-Result: Gopher Robot <go...@golang.org>
        ---
        M errgroup/errgroup.go
        1 file changed, 17 insertions(+), 1 deletion(-)

        diff --git a/errgroup/errgroup.go b/errgroup/errgroup.go
        index 1eab2fd..4c0850a 100644
        --- a/errgroup/errgroup.go
        +++ b/errgroup/errgroup.go
        @@ -17,7 +17,8 @@
        // A Group is a collection of goroutines working on subtasks that are part of
        // the same overall task.
        //
        -// A zero Group is valid and does not cancel on error.
        +// A zero Group is valid, has no limit on the number of active goroutines,
        +// and does not cancel on error.
        type Group struct {
        cancel func()


        To view, visit change 409774. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: sync
        Gerrit-Branch: master
        Gerrit-Change-Id: I1926e6faf821a7adb6c1365d18432abb0f856367
        Gerrit-Change-Number: 409774
        Gerrit-PatchSet: 5
        Gerrit-Owner: Jean de Klerk <dek...@google.com>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Changkun Ou <ma...@changkun.de>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Jean de Klerk <dek...@google.com>
        Gerrit-MessageType: merged
        Reply all
        Reply to author
        Forward
        0 new messages