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
os/exec: "fork/exec ... cannot allocate memory" on linux,!amd64 #31936
Comments
Change https://golang.org/cl/175697 mentions this issue: |
This allows the use of CLONE_VFORK and CLONE_VM for fork/exec, preventing "fork/exec ...: cannot allocate memory" failures from occuring when attempting to execute commands from a Go process that has a large memory footprint. Additionally, this should reduce the latency of fork/exec on these platforms. The same problem was addressed on linux/amd64 via issue #5838. Updates #31936 Change-Id: I7ae0fbbeaa29cab944a49a11272a380d497eb2d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/175697 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/189418 mentions this issue: |
This allows the use of CLONE_VFORK and CLONE_VM for fork/exec, preventing "fork/exec ...: cannot allocate memory" failures from occuring when attempting to execute commands from a Go process that has a large memory footprint. Additionally, this should reduce the latency of fork/exec on linux/arm64. With CLONE_VM the child process shares the same memory with the parent process. On its own this would lead to conflicting use of the same memory, so CLONE_VFORK is used to suspend the parent process until the child releases the memory when switching to the new program binary via the exec syscall. When the parent process continues to run, one has to consider the changes to memory that the child process did, namely the return address of the syscall function needs to be restored from a register. exec.Command() callers can start in a faster manner, as child process who do exec commands job can be cloned faster via vfork than via fork on arm64. The same problem was addressed on linux/amd64 via issue #5838. Updates #31936 Contributed by Howard Zhang <howard.zhang@arm.com> and Bin Lu <bin.lu@arm.com> Change-Id: Ia99d81d877f564ec60d19f17e596276836576eaf Reviewed-on: https://go-review.googlesource.com/c/go/+/189418 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
It would be nice to also have this fixed in linux/arm. There was a fix in https://go-review.googlesource.com/c/go/+/175697/5 but was removed. |
Still have the problem with linux/mipsle (compiled with go 1.13.4 windows/amd64) |
Change https://golang.org/cl/234960 mentions this issue: |
Updates #31936 Change-Id: I7dcb8987d4c306ccc97704b9c1b12313ba8bf242 Reviewed-on: https://go-review.googlesource.com/c/go/+/234960 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
this issue is impacting us pretty hard even on go 1.15 on linux/mipsle. |
Change https://golang.org/cl/295849 mentions this issue: |
@csystem-it - there is no real work around for this issue, short of either fixing the the syscall package, or rearchitecting your application. Feel free to try https://go-review.googlesource.com/c/go/+/295849 (the mipsle portion of that should be easy to backport to Go 1.15). |
I tried to backport and it seems to be working. |
@csystem-it The change in https://golang.org/cl/295849 will be in the upcoming Go 1.17 release. It was not in the Go 1.16 release. |
1 similar comment
@csystem-it The change in https://golang.org/cl/295849 will be in the upcoming Go 1.17 release. It was not in the Go 1.16 release. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?linux/s390x
What did you do?
On a linux/s390x LPAR with 12GB of RAM:
What did you expect to see?
What did you see instead?
This causes a production impact since various Go programs cannot fork/exec (including the Go compiler at times).
This is reproducable under Linux on most architectures aside from linux/amd64, where the problem has been addressed via issue #5838. The memory consumption will need to be altered depending on the available host memory.
The text was updated successfully, but these errors were encountered: