Skip to content
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

cmd/go: go get/mod tidy panics with internal error: net token acquired but not released #61877

Closed
it512 opened this issue Aug 9, 2023 · 11 comments
Assignees
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@it512
Copy link

it512 commented Aug 9, 2023

What version of Go are you using (go version)?

$ go version. 1.21.0

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/mikewang/.cache/go-build'
GOENV='/home/mikewang/.config/go/env'
GOEXE=''
GOEXPERIMENT='arenas'
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/mikewang/go/pkg/mod'
GONOPROXY='gitlab.it9i.com'
GONOSUMDB='gitlab.it9i.com'
GOOS='linux'
GOPATH='/home/mikewang/go'
GOPRIVATE='gitlab.it9i.com'
GOPROXY='https://goproxy.cn,direct'
GOROOT='/home/mikewang/go1.21.0'
GOSUMDB='sum.golang.google.cn'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/mikewang/go1.21.0/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/mikewang/go_w/goodsfamily/gis-comp/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4138640415=/tmp/go-build -gno-record-gcc-switches'

What did you do?

image
@seankhliao seankhliao changed the title cmd/go, run go get -u or go mod tidy panic cmd/go: go get/mod tidy panics with internal error: net token acquired but not released Aug 9, 2023
@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Aug 9, 2023
@bcmills bcmills self-assigned this Aug 9, 2023
@bcmills bcmills added this to the Go1.22 milestone Aug 9, 2023
@bcmills
Copy link
Member

bcmills commented Aug 9, 2023

Thanks for the report! Could you please paste the text of the error instead of a screenshot? The error messages clipped off the right side may be needed to figure out what code path is involved.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 9, 2023
@it512
Copy link
Author

it512 commented Aug 9, 2023

@bcmills Thanks a lot !

using private repos,set GONOPROXY='gitlab.****.com',

.gitconfig file:

[url "https://root:**@GitLab..com/"]
insteadOf = http://gitlab.****.com/

run go mod tidy to get from private repo, report error :

panic: internal error: net token acquired but not released

goroutine 17 [running]:
cmd/go/internal/base.(*netTokenChecker).panicUnreleased(0x0?)
cmd/go/internal/base/limit.go:83 +0x25
tidy failed: go mod tidy failed: exit status 2

run go get -u got same panic, but run go mod download , download from private repos is ok .

@bcmills
Copy link
Member

bcmills commented Aug 9, 2023

Can you post (redacted) output from go get -x?
My working hypothesis is that we are missing a Close call on an HTTP response body on some path.

@it512
Copy link
Author

it512 commented Aug 9, 2023

mikewang@VM-24-16-ubuntu:~/go_w/goodsfamily/gis-comp$ go get -x gitlab.it9i.com/comp/psdk/quit
# get https://gitlab.it9i.com/?go-get=1
# get https://gitlab.it9i.com/comp/psdk?go-get=1
# get https://gitlab.it9i.com/comp/psdk/quit?go-get=1
# get https://gitlab.it9i.com/comp?go-get=1
# get https://gitlab.it9i.com/?go-get=1: Get "http://gitlab.it9i.com/users/sign_in": redirected from secure URL https://gitlab.it9i.com/?go-get=1 to insecure URL http://gitlab.it9i.com/users/sign_in
# get https://gitlab.it9i.com/comp?go-get=1: Get "http://gitlab.it9i.com/users/sign_in": redirected from secure URL https://gitlab.it9i.com/comp?go-get=1 to insecure URL http://gitlab.it9i.com/users/sign_in
# get https://gitlab.it9i.com/comp/psdk?go-get=1: 200 OK (1.657s)
mkdir -p /home/mikewang/go/pkg/mod/cache/vcs # git3 http://gitlab.it9i.com/comp/psdk.git
# lock /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949.lock
# /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949 for git3 http://gitlab.it9i.com/comp/psdk.git
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git ls-remote -q origin
# get https://gitlab.it9i.com/comp/psdk/quit?go-get=1: 200 OK (1.717s)
# get https://gitlab.it9i.com/comp/psdk?go-get=1
# get https://gitlab.it9i.com/comp/psdk?go-get=1: 200 OK (0.388s)
4.535s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git ls-remote -q origin
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3cc60f3031024cd4a914967db73cf2 --
0.002s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3cc60f3031024cd4a914967db73cf2 --
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3c --
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3c --
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:quit/go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:quit/go.mod
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
panic: internal error: net token acquired but not released

goroutine 5 [running]:
cmd/go/internal/base.(*netTokenChecker).panicUnreleased(0x0?)
	cmd/go/internal/base/limit.go:83 +0x25
mikewang@VM-24-16-ubuntu:~/go_w/goodsfamily/gis-comp$ 

@bcmills
Copy link
Member

bcmills commented Aug 9, 2023

Thanks! That redirected from secure URL … to insecure URL error message seems like a strong lead.

@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 9, 2023
@it512
Copy link
Author

it512 commented Aug 9, 2023

mikewang@VM-24-16-ubuntu:~/go_w/goodsfamily/gis-comp$ cat ~/.gitconfig 

[user]
	email = it512@msn.com
	name = it512
[url "https://root:****@gitlab.***.com/"] ----------------- use https 
	insteadOf = https://gitlab.***com/

and run go get -x 
-------------------------------------------

# get https://gitlab.it9i.com/?go-get=1
# get https://gitlab.it9i.com/comp/psdk?go-get=1
# get https://gitlab.it9i.com/comp/psdk/quit?go-get=1
# get https://gitlab.it9i.com/comp?go-get=1
# get https://gitlab.it9i.com/comp/psdk/quit?go-get=1: 200 OK (1.263s)
# get https://gitlab.it9i.com/comp/psdk?go-get=1
# get https://gitlab.it9i.com/?go-get=1: Get "http://gitlab.it9i.com/users/sign_in": redirected from secure URL https://gitlab.it9i.com/?go-get=1 to insecure URL http://gitlab.it9i.com/users/sign_in
# get https://gitlab.it9i.com/comp?go-get=1: Get "http://gitlab.it9i.com/users/sign_in": redirected from secure URL https://gitlab.it9i.com/comp?go-get=1 to insecure URL http://gitlab.it9i.com/users/sign_in
# get https://gitlab.it9i.com/comp/psdk?go-get=1: 200 OK (1.564s)
mkdir -p /home/mikewang/go/pkg/mod/cache/vcs # git3 http://gitlab.it9i.com/comp/psdk.git
# lock /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949.lock
# /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949 for git3 http://gitlab.it9i.com/comp/psdk.git
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git ls-remote -q origin
# get https://gitlab.it9i.com/comp/psdk?go-get=1: 200 OK (0.337s)
3.832s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git ls-remote -q origin
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3cc60f3031024cd4a914967db73cf2 --
0.002s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3cc60f3031024cd4a914967db73cf2 --
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3c --
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c log.showsignature=false log --no-decorate -n1 '--format=format:%H %ct %D' 19c151beeb3c --
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git for-each-ref --format %(refname) refs/tags --merged 19c151beeb3cc60f3031024cd4a914967db73cf2
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:quit/go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:quit/go.mod
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
go: downloading gitlab.it9i.com/comp/psdk v0.0.0-20230808164723-19c151beeb3c
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
0.001s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git cat-file blob 19c151beeb3cc60f3031024cd4a914967db73cf2:go.mod
cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ 19c151beeb3cc60f3031024cd4a914967db73cf2
0.004s # cd /home/mikewang/go/pkg/mod/cache/vcs/4c89efdc50b5b0793d402c976db5dc6d0ddce712c63c60b3865bf20ec452a949; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ 19c151beeb3cc60f3031024cd4a914967db73cf2
panic: internal error: net token acquired but not released

goroutine 5 [running]:
cmd/go/internal/base.(*netTokenChecker).panicUnreleased(0x0?)
	cmd/go/internal/base/limit.go:83 +0x25

@bcmills
Copy link
Member

bcmills commented Aug 9, 2023

@gopherbot, please backport to Go 1.21. This is a regression that triggers an internal error.

@gopherbot
Copy link

Backport issue(s) opened: #61905 (for 1.21).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link

Change https://go.dev/cl/518015 mentions this issue: cmd/go/internal/web: release the net token when an HTTP request fails due to CheckRedirect

@gopherbot
Copy link

Change https://go.dev/cl/518016 mentions this issue: cmd/go/internal/web: remove a redundant return value

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 9, 2023
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 9, 2023
gopherbot pushed a commit that referenced this issue Aug 10, 2023
The URL return value from the fetch helper in web.get was always
either the passed in URL (on success) or nil (on failure).
Remove it to reduce code complexity.

For #61877.

Change-Id: I0ce4602b921d1c996aa988e7d3f83996511ccd72
Reviewed-on: https://go-review.googlesource.com/c/go/+/518016
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/518395 mentions this issue: [release-branch.go1.21] cmd/go/internal/web: release the net token when an HTTP request fails due to CheckRedirect

gopherbot pushed a commit that referenced this issue Aug 11, 2023
…en an HTTP request fails due to CheckRedirect

Updates #61877.
Fixes #61905.

Change-Id: I38c63565aaf9dc9b0c8085974521daccfbcbc790
Reviewed-on: https://go-review.googlesource.com/c/go/+/518015
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 8cb5c55)
Reviewed-on: https://go-review.googlesource.com/c/go/+/518395
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants