-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: default os stack size on windows amd64 is too small #8233
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
Labels
Milestone
Comments
1.3 is frozen. If the code worked on 1.2, changing something might be okay for 1.3.1. Please clarify. I doubt we'll give users control of stack size, since Go manages (Go) stacks automatically, growing and shrinking them as needed. It would be a weird API, even in the runtime package. For cgo calls, I'm not sure the best way to control the C stack size. Others might have thoughts. |
The clearest way to say it would be. C (not go) code on windows amd64 expects much larger os (not go) stacks. If there was a way to increase the os thread's stack size after it is created in windows I would not have filed this bug. Doubling the current stack reservation on windows amd64 fixes my problem, it may not fix other stack hungry c/cgo code. To fix other c stack (not go stack) hungry code I was recommending a function that started a new os thread with a much larger (and user defined) os stack size than the default, and then locking down the goroutine in the same way as a normal runtime.LockOSThread() to that thread. This would keep the amount of reserved memory low for randomly created threads, while enabling the use of stack hungry c code inside of that locked goroutine. Short fix for me is pkg/runtime/os_windows.c runtime·newosproc thandle = runtime·stdcall(runtime·CreateThread, 6, nil, (uintptr)0x20000, runtime·tstart_stdcall, mp, STACK_SIZE_PARAM_IS_A_RESERVATION, nil); Change 0x20000 (128KB) to 0x40000 (256KB) == real problem with a mainstream opengl driver running a necessary and basic initialization operation goes away. This would affect every os thread created, so having a runtime.LockSizedOSThread() would create a way to have small (0x20000) default stacks for normal threads and have troublesome c/cgo code running locked in a thread with a larger os stack. |
Sorry, I figured it out. Digging deeper this is happening because of https://golang.org/issue/4069 Feel free to close this issue, it is indirectly caused by 4069. I will find a work around till that gets fixed. Also congrats to the go team on go1.3 ;) |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: