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

go-callvis v0.7.0 go1.23.2 panic: runtime error: invalid memory address or nil pointer dereference [recovered] #197

Open
senjixu opened this issue Oct 21, 2024 · 11 comments · May be fixed by #202
Labels

Comments

@senjixu
Copy link

senjixu commented Oct 21, 2024

GOVERSION='go1.23.2'
go-callvis v0.7.0 
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=0x2 addr=0x0 pc=0x1006df404]

goroutine 79 [running]:
go/types.(*Checker).handleBailout(0x140004b2000, 0x1400080fbb8)
        /usr/local/go/src/go/types/check.go:404 +0x9c
panic({0x100c41a80?, 0x10108bad0?})
        /usr/local/go/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x100ce4598, 0x101092a00})
        /usr/local/go/src/go/types/sizes.go:229 +0x314
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:334
go/types.representableConst.func1({0x100ce4598?, 0x101092a00?})
        /usr/local/go/src/go/types/const.go:77 +0x90
go/types.representableConst({0x100ce7f98, 0x101043380}, 0x140004b2000, 0x101092a00, 0x1400080de48)
        /usr/local/go/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x140004b2000, 0x14000916800, 0x101092a00)
        /usr/local/go/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x140004b2000, 0x14000916800, {0x100ce4598, 0x101092a00})
        /usr/local/go/src/go/types/expr.go:377 +0x304
go/types.(*Checker).convertUntyped(0x140004b2000, 0x14000916800, {0x100ce4598, 0x101092a00})
        /usr/local/go/src/go/types/const.go:290 +0x30
go/types.(*Checker).isValidIndex(0x140004b2000, 0x14000916800, 0x34, {0x100ac46fb, 0x5}, 0x0)
        /usr/local/go/src/go/types/index.go:384 +0x64
go/types.(*Checker).index(0x140004b2000, {0x100ce6f50, 0x1400046e280}, 0xffffffffffffffff)
        /usr/local/go/src/go/types/index.go:355 +0x9c
go/types.(*Checker).builtin(0x140004b2000, 0x14000916780, 0x140004781c0, 0x9)
        /usr/local/go/src/go/types/builtins.go:520 +0x4014
go/types.(*Checker).callExpr(0x140004b2000, 0x14000916780, 0x140004781c0)
        /usr/local/go/src/go/types/call.go:230 +0xb04
go/types.(*Checker).exprInternal(0x140004b2000, 0x0, 0x14000916780, {0x100ce7070, 0x140004781c0}, {0x0, 0x0})
        /usr/local/go/src/go/types/expr.go:1410 +0xd0
go/types.(*Checker).rawExpr(0x140004b2000, 0x0, 0x14000916780, {0x100ce7070?, 0x140004781c0?}, {0x0?, 0x0?}, 0x0)
        /usr/local/go/src/go/types/expr.go:981 +0x120
go/types.(*Checker).multiExpr(0x140004b2000, {0x100ce7070, 0x140004781c0}, 0x0)
        /usr/local/go/src/go/types/expr.go:1568 +0x60
go/types.(*Checker).initVars(0x140004b2000, {0x1400052c2e0, 0x1, 0x1}, {0x140004640c0, 0x1, 0x1}, {0x0, 0x0})
        /usr/local/go/src/go/types/assignments.go:425 +0x100
go/types.(*Checker).shortVarDecl(0x140004b2000, {0x100ce22a0, 0x140001a6258}, {0x14000464090, 0x1, 0x100cac5a0?}, {0x140004640c0, 0x1, 0x1})
        /usr/local/go/src/go/types/assignments.go:573 +0x65c
go/types.(*Checker).stmt(0x140004b2000, 0x0, {0x100ce6c20, 0x14000478200})
        /usr/local/go/src/go/types/stmt.go:480 +0xce0
go/types.(*Checker).stmtList(0x140004b2000, 0x0, {0x14000478300?, 0x140004b2000?, 0x100c5d520?})
        /usr/local/go/src/go/types/stmt.go:121 +0x88
go/types.(*Checker).funcBody(0x140004b2000, 0x100ce70a0?, {0x14000592158?, 0x1006a80ec?}, 0x1400065f4c0, 0x14000468210, {0x0?, 0x0?})
        /usr/local/go/src/go/types/stmt.go:41 +0x218
go/types.(*Checker).funcDecl.func1()
        /usr/local/go/src/go/types/decl.go:888 +0x44
go/types.(*Checker).processDelayed(0x140004b2000, 0x0)
        /usr/local/go/src/go/types/check.go:516 +0x12c
go/types.(*Checker).checkFiles(0x140004b2000, {0x1400046a000, 0x1, 0x1})
        /usr/local/go/src/go/types/check.go:462 +0x1b4
go/types.(*Checker).Files(0x140001aa000?, {0x1400046a000?, 0x1400007e4e0?, 0x6?})
        /usr/local/go/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x140001aa000, 0x140003c4ea0)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1052 +0x858
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
        /usr/local/go/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:839 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:846 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 24
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:845 +0x84
bruce@kkk-bruce connectionquality % 
bruce@kkk-bruce connectionquality % 
bruce@kkk-bruce connectionquality % 
bruce@kkk-bruce connectionquality % 
bruce@kkk-bruce connectionquality % go-callvis scorer.go
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=0x2 addr=0x0 pc=0x103147404]

goroutine 526 [running]:
go/types.(*Checker).handleBailout(0x140008e5500, 0x14000b0bbb8)
        /usr/local/go/src/go/types/check.go:404 +0x9c
panic({0x1036a9a80?, 0x103af3ad0?})
        /usr/local/go/src/runtime/panic.go:785 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x10374c598, 0x103afaa00})
        /usr/local/go/src/go/types/sizes.go:229 +0x314
go/types.(*Config).sizeof(...)
        /usr/local/go/src/go/types/sizes.go:334
go/types.representableConst.func1({0x10374c598?, 0x103afaa00?})
        /usr/local/go/src/go/types/const.go:77 +0x90
go/types.representableConst({0x10374ff98, 0x103aab388}, 0x140008e5500, 0x103afaa00, 0x14000b0b488)
        /usr/local/go/src/go/types/const.go:93 +0x134
go/types.(*Checker).representation(0x140008e5500, 0x14000242400, 0x103afaa00)
        /usr/local/go/src/go/types/const.go:257 +0x68
go/types.(*Checker).implicitTypeAndValue(0x140008e5500, 0x14000242400, {0x10374c5e8, 0x14000b120e0})
        /usr/local/go/src/go/types/expr.go:377 +0x304
go/types.(*Checker).assignment(0x140008e5500, 0x14000242400, {0x10374c5e8, 0x14000b120e0}, {0x103534b13, 0x14})
        /usr/local/go/src/go/types/assignments.go:70 +0x3ac
go/types.(*Checker).initConst(0x140008e5500, 0x140001cf1a0, 0x14000242400)
        /usr/local/go/src/go/types/assignments.go:144 +0x1f8
go/types.(*Checker).constDecl(0x140008e5500, 0x140001cf1a0, {0x10374ea10, 0x140008fa0e0}, {0x10374e950, 0x140008f4090}, 0x0)
        /usr/local/go/src/go/types/decl.go:482 +0x23c
go/types.(*Checker).objDecl(0x140008e5500, {0x1037574d8, 0x140001cf1a0}, 0x0)
        /usr/local/go/src/go/types/decl.go:185 +0x840
go/types.(*Checker).packageObjects(0x140008e5500)
        /usr/local/go/src/go/types/resolver.go:714 +0x3f0
go/types.(*Checker).checkFiles(0x140008e5500, {0x140008f6000, 0x1, 0x1})
        /usr/local/go/src/go/types/check.go:459 +0x190
go/types.(*Checker).Files(0x140001cc0e0?, {0x140008f6000?, 0x140001cee40?, 0x6?})
        /usr/local/go/src/go/types/check.go:422 +0x80
golang.org/x/tools/go/packages.(*loader).loadPackage(0x140001cc0e0, 0x14000231110)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1052 +0x858
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:851 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
        /usr/local/go/src/sync/once.go:76 +0xf8
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:839 +0x48
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:846 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 164
        /Users/bruce/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:845 +0x84
@mutantkeyboard
Copy link

I'm having the exact same issue.

@chriscasola
Copy link

I wonder if this warning when installing go-callvis is related:

# github.com/goccy/go-graphviz/internal/ccall
In file included from cgraph.c:7:
cgraph/graph.c: In function ‘agopen’:
cgraph/graph.c:47:11: note: parameter passing for argument of type ‘Agdesc_t’ {aka ‘struct Agdesc_s’} changed in GCC 9.1
   47 | Agraph_t *agopen(char *name, Agdesc_t desc, Agdisc_t * arg_disc)
      |           ^~~~~~

@sincerefly
Copy link

go1.23.3 darwin/arm64, same error

@edgan
Copy link

edgan commented Nov 22, 2024

I tried downgrading from 1.23.3 to 1.20.14, 1.21.12 ,and 1.22.9. I had the same problem with each.

@edgan
Copy link

edgan commented Nov 22, 2024

I finally got it to work by going back to 1.19.13.

@mutantkeyboard
Copy link

@edgan - but that'd mean that something is related to the core Go API between version 1.19 and 1.23, no?

I didn't really look into the go-callvis source code so far but I emailed @ondrajz a couple of weeks ago related to this issue.

Since, I have some spare time, I could have a better look into the issue and try to do a bugfix or workaround.

@sgargan
Copy link

sgargan commented Nov 29, 2024

I'm seeing this with both 1.19.13 and 1.23

@mutantkeyboard
Copy link

mutantkeyboard commented Dec 1, 2024

@edgan - but that'd mean that something is related to the core Go API between version 1.19 and 1.23, no?

I didn't really look into the go-callvis source code so far but I emailed @ondrajz a couple of weeks ago related to this issue.

I've investigated a bit further and it seems like the issue has been fixed in this PR - #177
However, it still isn't merged.

@edgan
Copy link

edgan commented Dec 4, 2024

@edgan - but that'd mean that something is related to the core Go API between version 1.19 and 1.23, no?

I didn't really look into the go-callvis source code so far but I emailed @ondrajz a couple of weeks ago related to this issue.

I've investigated a bit further and it seems like the issue has been fixed in this PR - #177 However, it still isn't merged.

I tried the changes in PR #177. It gets rid of this error, but it has another one. I tried on both of my projects with the same results. Yet going back to 1.19.13 works with both projects. Searching for the error in the issues here came up with nothing.

I am running Fedora 41 with golang-bin-1.23.3-1.fc41.x86_64. I found 1.19.13 by searching koji here.

Edit: Created issue #201.

New error from project one:

panic: Cannot range over: func(yield func(*golang.org/x/net/html.Node) bool)

goroutine 2267 [running]:
golang.org/x/tools/go/ssa.(*builder).rangeStmt(0xc00e94f3f0, 0xc00c761040, 0xc00995b320, 0x0)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2279 +0x805
golang.org/x/tools/go/ssa.(*builder).stmt(0xc00e94f3f0, 0xc00c761040, {0xc18a80?, 0xc00995b320?})
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2503 +0x205
golang.org/x/tools/go/ssa.(*builder).stmtList(...)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:909
golang.org/x/tools/go/ssa.(*builder).stmt(0xc00e94f3f0, 0xc00c761040, {0xc18900?, 0xc00d422d80?})
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2465 +0xe47
golang.org/x/tools/go/ssa.(*builder).buildFromSyntax(0xc00e94f3f0, 0xc00c761040)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2577 +0x245
golang.org/x/tools/go/ssa.(*builder).buildFunction(0xac1cc0?, 0xc00c761040)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2531 +0x17b
golang.org/x/tools/go/ssa.(*builder).iterate(0xc00e94f3f0)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2519 +0x25
golang.org/x/tools/go/ssa.(*Package).build(0xc00f04e980)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2648 +0xa9
sync.(*Once).doSlow(0xc0002de7b8?, 0x6d4d78?)
	/usr/lib/golang/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
	/usr/lib/golang/src/sync/once.go:67
golang.org/x/tools/go/ssa.(*Package).Build(...)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2637
golang.org/x/tools/go/ssa.(*Program).Build.func1(0x69746e7572220909?)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2620 +0x45
created by golang.org/x/tools/go/ssa.(*Program).Build in goroutine 1
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2619 +0x187

New error from project two:

panic: Cannot range over: func(yield func(E) bool)

goroutine 2027 [running]:
golang.org/x/tools/go/ssa.(*builder).rangeStmt(0xc013097780, 0xc0116dc680, 0xc0035263c0, 0x0)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2279 +0x805
golang.org/x/tools/go/ssa.(*builder).stmt(0xc013097780, 0xc0116dc680, {0xc18a80?, 0xc0035263c0?})
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2503 +0x205
golang.org/x/tools/go/ssa.(*builder).stmtList(...)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:909
golang.org/x/tools/go/ssa.(*builder).stmt(0xc013097780, 0xc0116dc680, {0xc18900?, 0xc00328ccc0?})
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2465 +0xe47
golang.org/x/tools/go/ssa.(*builder).buildFromSyntax(0xc013097780, 0xc0116dc680)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2577 +0x245
golang.org/x/tools/go/ssa.(*builder).buildFunction(0xac1cc0?, 0xc0116dc680)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2531 +0x17b
golang.org/x/tools/go/ssa.(*builder).iterate(0xc013097780)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2519 +0x25
golang.org/x/tools/go/ssa.(*Package).build(0xc01147af80)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2648 +0xa9
sync.(*Once).doSlow(0xc0007a0fb8?, 0x6d4d78?)
	/usr/lib/golang/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
	/usr/lib/golang/src/sync/once.go:67
golang.org/x/tools/go/ssa.(*Package).Build(...)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2637
golang.org/x/tools/go/ssa.(*Program).Build.func1(0x0?)
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2620 +0x45
created by golang.org/x/tools/go/ssa.(*Program).Build in goroutine 1
	/home/ngrennan/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2619 +0x187

@kingsmao
Copy link

kingsmao commented Dec 6, 2024

👀

@ondrajz ondrajz linked a pull request Dec 31, 2024 that will close this issue
@ondrajz
Copy link
Owner

ondrajz commented Dec 31, 2024

Hello, sorry for my inactivity. Thank you all for the input and reports.

I have opened new PR #202 that should address all the remaining issues. It would be great if someone can test it out to confirm it works okay now.

@edgan especially you could test with issues you had above.

@ondrajz ondrajz added the bug label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants