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

Nil reference panic while building #945

Closed
paralin opened this issue Oct 4, 2019 · 4 comments

Comments

@paralin
Copy link

commented Oct 4, 2019

I'm getting a reproducible nil pointer dereference panic when building with the master branch and go 1.12.10:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x4dd25c]

goroutine 1 [running]:
golang.org/x/tools/go/internal/gcimporter.IExportData.func1(0xc0001fe468)
        /go/pkg/mod/golang.org/x/tools@v0.0.0-20191004034534-88641d98b32a/go/internal/gcimporter/iexport.go:40 +0xbb
panic(0x968ca0, 0xe8ff40)
        /go/src/runtime/panic.go:522 +0x1b5
sync.(*RWMutex).RLock(...)
        /go/src/sync/rwmutex.go:48
go/token.(*FileSet).file(0x0, 0x12b, 0xc0001d8f40)
        /go/src/go/token/position.go:452 +0x2c
go/token.(*FileSet).PositionFor(0x0, 0x12b, 0xc0001fe101, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/src/go/token/position.go:492 +0x61
go/token.(*FileSet).Position(...)
        /go/src/go/token/position.go:503
golang.org/x/tools/go/internal/gcimporter.(*exportWriter).pos(0xc000196c30, 0x12b)
        /go/pkg/mod/golang.org/x/tools@v0.0.0-20191004034534-88641d98b32a/go/internal/gcimporter/iexport.go:270 +0x72
golang.org/x/tools/go/internal/gcimporter.(*iexporter).doDecl(0xc000200000, 0xaf8940, 0xc000196870)
        /go/pkg/mod/golang.org/x/tools@v0.0.0-20191004034534-88641d98b32a/go/internal/gcimporter/iexport.go:214 +0x360
golang.org/x/tools/go/internal/gcimporter.IExportData(0x0, 0xc0001967d0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/pkg/mod/golang.org/x/tools@v0.0.0-20191004034534-88641d98b32a/go/internal/gcimporter/iexport.go:70 +0x308
golang.org/x/tools/go/gcexportdata.Write(0xae4640, 0xc0001d0f90, 0x0, 0xc0001967d0, 0xc0001e35a8, 0x1)
        /go/pkg/mod/golang.org/x/tools@v0.0.0-20191004034534-88641d98b32a/go/gcexportdata/gcexportdata.go:103 +0x39
github.com/gopherjs/gopherjs/compiler.Compile(0xc000028749, 0x6, 0xc000010318, 0x1, 0x1, 0xc000076c00, 0xc000064d70, 0x0, 0x0, 0x3, ...)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/compiler/package.go:168 +0x68a
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc000020f30, 0xc000196550, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/build/build.go:702 +0x82c
github.com/gopherjs/gopherjs/build.(*Session).buildImportPathWithSrcDir(0xc000020f30, 0xc000028749, 0x6, 0xc00002a360, 0x26, 0x0, 0x26, 0xc000079260, 0x6)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/build/build.go:590 +0x143
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc000020f30, 0xc0001964b0, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/build/build.go:637 +0x133f
github.com/gopherjs/gopherjs/build.(*Session).buildImportPathWithSrcDir(0xc000020f30, 0xc000028481, 0x7, 0xc00002e280, 0x40, 0x0, 0x2, 0x1a, 0x3b)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/build/build.go:590 +0x143
github.com/gopherjs/gopherjs/build.(*Session).BuildPackage(0xc000020f30, 0xc000196190, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/build/build.go:637 +0x133f
main.main.func1.1(0xc000064370, 0x0, 0x1, 0xc0000641d0, 0xc000020f30, 0xc0000762c0, 0x8d6b00, 0xc0000d1c08)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/tool.go:139 +0x747
main.main.func1(0xc00018e000, 0xc000064370, 0x0, 0x1)
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/tool.go:155 +0xda
github.com/spf13/cobra.(*Command).execute(0xc00018e000, 0xc000064360, 0x1, 0x1, 0xc00018e000, 0xc000064360)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2ae
github.com/spf13/cobra.(*Command).ExecuteC(0xc00018f400, 0xc0000d1f48, 0x8, 0x8)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fc
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
        /go/pkg/mod/github.com/gopherjs/gopherjs@v0.0.0-20190915194858-d3ddacdb130f/tool.go:534 +0x12b8

Not sure why.

@dmitshur

This comment has been minimized.

Copy link
Member

commented Oct 4, 2019

Thanks for reporting. This is a known temporary issue due to a change in CL 198742 in x/tools. This will be fixed in CL 198857, which has been reviewed and is likely going to be merged pretty soon. /cc @stamblerre

If you need to work around this until then, you can use the patch in commit b0dba0a.

@stamblerre

This comment has been minimized.

Copy link

commented Oct 4, 2019

CL 198857 has been merged, so this should now be resolved. Please follow up if you encounter any further issues.

@dmitshur

This comment has been minimized.

Copy link
Member

commented Oct 4, 2019

Thank you for resolving the issue @stamblerre!

@dmitshur dmitshur closed this Oct 4, 2019
@paralin

This comment has been minimized.

Copy link
Author

commented Oct 6, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.