-
Notifications
You must be signed in to change notification settings - Fork 18k
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
runtime/cgo: -extldflags=-stack_size=NNN does not set stack size used by runtime/cgo #28024
Comments
I've currently modified gcc_darwin_amd64.c to allow setting stack size at compilation time:
|
Does it work if you use |
No, I tried that and it still panics:
The program passes a callback function to the library, the crash is when returning from the go callback:
|
I don't understand why that would be. Do you have a complete test case you can show us that recreates the problem? |
Not my exact problem (still trying to isolate it into a sample, cannot make "preparePanic" lock) but one showing setting the stack size does not help (note stack size returned by pthread): First attempt: calling Go callback causes a crash
Second attempt with no callback showing a clean execution (comment out in repro.h last printf calling goCallback):
|
I'm running into this same issue with my code that calls into cgo that requires a larger stack size. @p8a Edit: @ianlancetaylor's suggestion of |
It would help if somebody could provide a small self-contained test case that demonstrates the problem. |
Just to note if someone else runs into it: I thought I needed this because I was getting a weird panic ("fatal: morestack on g0"). Turns out I had a stack overflow in complicated CGo code that was traversing a cyclic tree going back and forth between C and Go with a callback, but I didn't expect it to be cyclic so I ended up with a stack overflow due to endless recursion. |
@ianlancetaylor my last comment (#28024 (comment)) has a test case |
@p8a My apologies. Thanks for sending that. Although I'm surprised to see |
So, partially to bump this, because I'm debugging something similar, this can still be reproduced as of Go 1.14.2, and even without |
TG has minimal requirement of Go1.5, so better switch to 1.5.4 fir debugging. |
This introduces _experimental_ block execution run by embedded Silkworm API library: - new command-line option `silkworm.path` to enable the feature by specifying the path to the Silkworm library - the Silkworm API shared library is dynamically loaded on-demand - currently requires to build Silkworm library on the target machine - available only on Linux at the moment: macOS has issue with [stack size](golang/go#28024) and Windows would require [TDM-GCC-64](https://jmeubank.github.io/tdm-gcc/), both need dedicated effort for an assessment
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.11 darwin/amd64
macOS Sierra (10.12.6)
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
Integrating via cgo a 3rd-party library which requires 2mb stack space does not work because stack size is set to default PTHREAD_STACK_MIN (which is less).
The runtime behavior manifests as a deadlocked "panic" call with the following stack:
What did you expect to see?
Panic being triggered and a way to set cgo stack size.
What did you see instead?
The text was updated successfully, but these errors were encountered: