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
x/crypto/bcrypt: memory usage #26122
Comments
To debug a leak you want to use |
Hi @FiloSottile using --inuse_space:
|
To make it easier for us to reproduce your results, can you try writing up standalone code that we can run? Obviously, we don't want your code to include actual passwords from your production environment. (I wasn't able to reproduce your results, but maybe your usage pattern is affecting memory usage.) If you write it in the form of a benchmark, you can run |
@meirf I tried two ways to reproduce, one with the code in a main(), compiling and using pkg/profile. The other with benchmark. The first way I could reproduce but not with the second. |
I don't see proof of any problem from these gists. The first link shows Also, now that I look more closely at your pprof output above I notice the unit is time instead of space so I think you were running pprof on a cpu profile instead of a memory profile. Time can impact space - if there's not enough time, there might not be enough time to gc, but I don't think that's what you intended in your output. |
Thanks for the clarification @meirf and @FiloSottile. It's not the issue then. Appreciate your help. |
What version of Go are you using (
go version
)?go version go1.9.2 darwin/amd64
Does this issue reproduce with the latest release?
Latest x/crypto/bcrypt
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/henriquechehad/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/qd/mjm4kwn53k3b2zmzl_5pkznh0000gn/T/go-build787818303=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
Description
During the project usage, I noticed that the memory allocation is always increasing during requests and not decreasing after stopping the requests, there's a memory leak. I used
pprof
to try to find it and saw with theheap
that thebcrypt
was with almost all the memory usage during the usage. As I don't have experience with bcrypt implementation, I can not ensure that it's the issue. But it sounds like a thing to check. It's by far the project part that is more allocating memory.Seems it's specifically in this function: https://github.com/golang/crypto/blob/master/blowfish/block.go#L115
The code that calls it:
The text was updated successfully, but these errors were encountered: