-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
CGO keeps memory increasing in a goroutine and got killed by OOM. #53440
Comments
That program allocates a lot of memory. Each iteration of the loop in What is your |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
Sorry for the late reply.
It was intended for seeing memory usage because deploy server has 256G memory.
it is
In both case(example and my decode server), It got For the record, I solved this memory issue applying two things.
|
I changed glibc(GNU C Allocator) to tcmalloc which solved a similar problem. |
What version of Go are you using (
go version
)?I tested 1.17, 1.18, 1.19beta1 and 1.18.3(currently latest) already.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?This issue happens a PopOS 22.04 with go-1.18.3 and a Ubuntu 22.04 docker container with go-1.18.
go env
OutputWhat did you do?
I use gRPC in go server and call deep learning inference using CGO. I already tested the DL library and C++ TCP server and there isn't any memory leak. This issue is happened when memory allocation with CGO in a goroutine.
I found a similar issue in stackoverflow.
I don't know this issue is a bug or not. This phenomenon is really unclear to me. I have been trying to solve this issue. But for now, I feel only solution is I would change it's implementation to C++ or Rust version.
$ time go run main.go signal: killed real 8m19.677s user 11m58.797s sys 5m22.965s
Memory usage
memusage-20220618_211256.log
What did you expect to see?
When cgo call is done, go runtime have to reduce memory usage.
What did you see instead?
Memory keeps increasing and Go process got killed by OOM. Docker container restarts repeatedly under heavy requests.
Similar issues
The text was updated successfully, but these errors were encountered: