net: create resolver semaphore channels eagerly - #80906
net: create resolver semaphore channels eagerly#80906serhiy-bzhezytskyy wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
131e7b0 to
20e14e1
Compare
A lookup from outside a testing/synctest bubble, after net's resolver has been used inside one, aborts with "send on synctest channel from outside bubble". One test order runs to completion and another aborts the process, and a fatal error reports no failing test. resolverConfig.ch and nsswitchConfig.ch are created inside their initOnce.Do, so each is associated with the bubble of the first caller to reach the resolver. Both are used only as one-slot semaphores, so they are now created in their package-level var initializers, where no bubble exists. That removes the ordering dependence at no cost. threadLimit in net.go has the same shape but is left alone: its capacity derives from rlim.Cur, and a program may lower RLIMIT_NOFILE after package initialization, so eager creation could permit more concurrent getaddrinfo calls than there are descriptors. Updates golang#80903
20e14e1 to
458c755
Compare
|
This PR (HEAD: 458c755) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/816200. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/816200. |
A lookup from outside a testing/synctest bubble, after net's resolver has been used inside one, aborts with "send on synctest channel from outside bubble". One test order runs to completion and another aborts the process, and a fatal error reports no failing test.
resolverConfig.ch and nsswitchConfig.ch are created inside their initOnce.Do, so each is associated with the bubble of the first caller to reach the resolver.
Both are used only as one-slot semaphores, so they are now created in their package-level var initializers, where no bubble exists. That removes the ordering dependence at no cost.
threadLimit in net.go has the same shape but is left alone: its capacity derives from rlim.Cur, and a program may lower RLIMIT_NOFILE after package initialization, so eager creation could permit more concurrent getaddrinfo calls than there are descriptors.
Updates #80903