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: panic in 'go work use' #50958

Closed
bcmills opened this issue Feb 1, 2022 · 2 comments
Closed

cmd/go: panic in 'go work use' #50958

bcmills opened this issue Feb 1, 2022 · 2 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Feb 1, 2022

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

$ go version
go version devel go1.18-3519271976 Tue Feb 1 15:42:07 2022 -0500 linux/amd64

What did you do?

Add the following test script as cmd/go/testdata/script/work_use_issueXXXXX.txt:

go work use -r .
cmp go.work go.work.want

-- go.mod --
module example
go 1.18
-- go.work --
go 1.18

use (
	sub
)
-- sub/README.txt --
This directory no longer contains a go.mod file.

Run it using go test cmd/go -run=TestScript/work_use_deleted.

What did you expect to see?

A passing test, or a diff showing some mistaken assumption on my part.

What did you see instead?

+ go test cmd/go '-run=TestScript/^(work_use_issueXXXXX)$'
go test proxy running at GOPROXY=http://127.0.0.1:44271/mod
--- FAIL: TestScript (0.02s)
    --- FAIL: TestScript/work_use_issueXXXXX (0.03s)
        script_test.go:257:
            > go work use -r .
            [stderr]
            panic: runtime error: invalid memory address or nil pointer dereference
            [signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0x78c5b1]

            goroutine 1 [running]:
            panic({0x958fa0, 0xda8e20})
                /usr/local/google/home/bcmills/go/src/runtime/panic.go:941 +0x397 fp=0xc0000cf5f8 sp=0xc0000cf538 pc=0x435357
            runtime.panicmem(...)
                /usr/local/google/home/bcmills/go/src/runtime/panic.go:220
            runtime.sigpanic()
                /usr/local/google/home/bcmills/go/src/runtime/signal_unix.go:802 +0x336 fp=0xc0000cf648 sp=0xc0000cf5f8 pc=0x44b096
            cmd/vendor/golang.org/x/mod/modfile.(*FileSyntax).updateLine(...)
                /usr/local/google/home/bcmills/go/src/cmd/vendor/golang.org/x/mod/modfile/read.go:191
            cmd/vendor/golang.org/x/mod/modfile.(*WorkFile).AddUse(0xc0001a8200, {0x0, 0x0}, {0xc000000ad6, 0x7})
                /usr/local/google/home/bcmills/go/src/cmd/vendor/golang.org/x/mod/modfile/work.go:142 +0x1d1 fp=0xc0000cf6c0 sp=0xc0000cf648 pc=0x78c5b1
            cmd/go/internal/modload.UpdateWorkFile(0xc0001a8200)
                /usr/local/google/home/bcmills/go/src/cmd/go/internal/modload/init.go:626 +0x21d fp=0xc0000cf8f0 sp=0xc0000cf6c0 pc=0x7eb0fd
            cmd/go/internal/workcmd.runUse({0xad78e0?, 0xc0000000d0?}, 0xc00002e2a0?, {0xc0000220e0, 0x1, 0x2?})
                /usr/local/google/home/bcmills/go/src/cmd/go/internal/workcmd/use.go:128 +0x54f fp=0xc0000cfd98 sp=0xc0000cf8f0 pc=0x81964f
            main.invoke(0xdb3700, {0xc0000220c0, 0x3, 0x3})
                /usr/local/google/home/bcmills/go/src/cmd/go/main.go:218 +0x2ee fp=0xc0000cfe60 sp=0xc0000cfd98 pc=0x90072e
            main.main()
                /usr/local/google/home/bcmills/go/src/cmd/go/main.go:175 +0x78e fp=0xc0000cff80 sp=0xc0000cfe60 pc=0x90010e
            runtime.main()
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:255 +0x227 fp=0xc0000cffe0 sp=0xc0000cff80 pc=0x437ee7
            runtime.goexit()
                /usr/local/google/home/bcmills/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000cffe8 sp=0xc0000cffe0 pc=0x465361

            goroutine 2 [force gc (idle)]:
            runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:366 +0xd6 fp=0xc000052fb0 sp=0xc000052f90 pc=0x4382b6
            runtime.goparkunlock(...)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:372
            runtime.forcegchelper()
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:306 +0xad fp=0xc000052fe0 sp=0xc000052fb0 pc=0x43814d
            runtime.goexit()
                /usr/local/google/home/bcmills/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x465361
            created by runtime.init.6
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:294 +0x25

            goroutine 3 [GC sweep wait]:
            runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:366 +0xd6 fp=0xc000053790 sp=0xc000053770 pc=0x4382b6
            runtime.goparkunlock(...)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:372
            runtime.bgsweep(0x0?)
                /usr/local/google/home/bcmills/go/src/runtime/mgcsweep.go:278 +0x8e fp=0xc0000537c8 sp=0xc000053790 pc=0x42542e
            runtime.gcenable.func1()
                /usr/local/google/home/bcmills/go/src/runtime/mgc.go:177 +0x26 fp=0xc0000537e0 sp=0xc0000537c8 pc=0x41b166
            runtime.goexit()
                /usr/local/google/home/bcmills/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000537e8 sp=0xc0000537e0 pc=0x465361
            created by runtime.gcenable
                /usr/local/google/home/bcmills/go/src/runtime/mgc.go:177 +0x6b

            goroutine 4 [GC scavenge wait]:
            runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:366 +0xd6 fp=0xc000053f30 sp=0xc000053f10 pc=0x4382b6
            runtime.goparkunlock(...)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:372
            runtime.bgscavenge(0x0?)
                /usr/local/google/home/bcmills/go/src/runtime/mgcscavenge.go:271 +0xec fp=0xc000053fc8 sp=0xc000053f30 pc=0x42310c
            runtime.gcenable.func2()
                /usr/local/google/home/bcmills/go/src/runtime/mgc.go:178 +0x26 fp=0xc000053fe0 sp=0xc000053fc8 pc=0x41b106
            runtime.goexit()
                /usr/local/google/home/bcmills/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x465361
            created by runtime.gcenable
                /usr/local/google/home/bcmills/go/src/runtime/mgc.go:178 +0xaa

            goroutine 5 [finalizer wait]:
            runtime.gopark(0xdbfe60?, 0xc000005a00?, 0x70?, 0x27?, 0x444e31?)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:366 +0xd6 fp=0xc000052630 sp=0xc000052610 pc=0x4382b6
            runtime.goparkunlock(...)
                /usr/local/google/home/bcmills/go/src/runtime/proc.go:372
            runtime.runfinq()
                /usr/local/google/home/bcmills/go/src/runtime/mfinal.go:177 +0xb3 fp=0xc0000527e0 sp=0xc000052630 pc=0x41a1f3
            runtime.goexit()
                /usr/local/google/home/bcmills/go/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0000527e8 sp=0xc0000527e0 pc=0x465361
            created by runtime.createfing
                /usr/local/google/home/bcmills/go/src/runtime/mfinal.go:157 +0x45
            [exit status 2]
            FAIL: testdata/script/work_use_issueXXXXX.txt:1: unexpected command failure

FAIL
FAIL    cmd/go  0.852s
FAIL
@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 1, 2022
@bcmills bcmills self-assigned this Feb 1, 2022
@bcmills bcmills added this to the Go1.18 milestone Feb 1, 2022
@gopherbot
Copy link

Change https://golang.org/cl/382245 mentions this issue: cmd/go/internal/modload: skip deleted entries in UpdateWorkFile

@bcmills
Copy link
Member Author

bcmills commented Feb 1, 2022

Marking as release-blocker because this causes a panic (and has a pending fix).

@rsc rsc unassigned bcmills Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants