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

Stack size exceeded in error assignment cycle #57

Closed
jmacd opened this issue Sep 6, 2023 · 2 comments
Closed

Stack size exceeded in error assignment cycle #57

jmacd opened this issue Sep 6, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jmacd
Copy link

jmacd commented Sep 6, 2023

I have a fragment of code which caused go-errorlint to crash, thought I'd share:

https://github.com/open-telemetry/otel-arrow/blob/d198a41f4c5a43451ab47d0841776412cd3c8fa0/collector/receiver/otelarrowreceiver/internal/arrow/arrow.go#L338

The code clearly suffers from scoping problems around two variables err and authErr, which are assigned to each other in a cycle. It looks like this ties up the analysis until the stack is exceeded.

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x140341803e0 stack=[0x14034180000, 0x14054180000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x1016bf12e?, 0x102304fe0?})
	runtime/panic.go:1047 +0x40 fp=0x28800ed50 sp=0x28800ed20 pc=0x100b690f0
runtime.newstack()
	runtime/stack.go:1105 +0x460 fp=0x28800ef00 sp=0x28800ed50 pc=0x100b83590
runtime.morestack()
	runtime/asm_arm64.s:316 +0x70 fp=0x28800ef00 sp=0x28800ef00 pc=0x100b9cd70

goroutine 10559 [running]:
runtime.heapBitsSetType(0x1400baf1018, 0x8, 0x8, 0x101a80ee0)
	runtime/mbitmap.go:942 +0x4bc fp=0x140341803e0 sp=0x140341803e0 pc=0x100b4645c
runtime.mallocgc(0x8, 0x101a80ee0, 0x1)
	runtime/malloc.go:1074 +0x58c fp=0x14034180450 sp=0x140341803e0 pc=0x100b3db4c
runtime.growslice(0x14034180508, 0x1400b5bc810?, 0x140092b61c0?, 0x102a505e0?, 0x101a80ee0)
	runtime/slice.go:274 +0x400 fp=0x140341804b0 sp=0x14034180450 pc=0x100b81760
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b61c0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:149 +0x124 fp=0x140341805b0 sp=0x140341804b0 pc=0x1010ca534
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b60e0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x140341806b0 sp=0x140341805b0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b61c0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x140341807b0 sp=0x140341806b0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b60e0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x140341808b0 sp=0x140341807b0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b61c0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x140341809b0 sp=0x140341808b0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b60e0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x14034180ab0 sp=0x140341809b0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b61c0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x14034180bb0 sp=0x14034180ab0 pc=0x1010ca780
github.com/polyfloyd/go-errorlint/errorlint.assigningCallExprs(0x140040fbc20, 0x140092b60e0)
	github.com/polyfloyd/go-errorlint@v1.4.3/errorlint/allowed.go:184 +0x370 fp=0x14034180cb0 sp=0x14034180bb0 pc=0x101

and so on. I'm going to rewrite this code to avoid the cycle, anyway, thanks!

@jmacd
Copy link
Author

jmacd commented Sep 6, 2023

@polyfloyd
Copy link
Owner

Hi! Thanks for reporting this! I'll see what can be done about this

@polyfloyd polyfloyd added the bug Something isn't working label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants