Skip to content
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

gccgo: alloc space keeps on increasing even with a simple go program using grpc #25103

Closed
amandeepgautam opened this issue Apr 26, 2018 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@amandeepgautam
Copy link

amandeepgautam commented Apr 26, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10 gccgo (GCC) 8.0.1 20180305 (experimental) aix/ppc

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

OS: AIX 7.2
relevant go env flags:
GOARCH="ppc"
CC="gcc"
CXX="g++"
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"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build337480888=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

I have a simple grpc server and a client with makes request frequently. The program can be found here. Please create a dir and extract the contents of the tar file to it. Make sure that $GOPATH is exported correctly. Execute ./run.sh.

What did you expect to see?

The DATA RES section should be stable in terms of memory usage

What did you see instead?

For a program running days, this memory bloats up to 5-6 GB and then the system freezes. Surprisingly the program does not crash. For this particular example, following is the pprof output at the start of the program and hew seconds later:

At the start of the program:

 go tool pprof --alloc_space http://10.2.144.87:50048/debug/pprof/heap
Fetching profile from http://10.2.144.87:50048/debug/pprof/heap
Saved profile in /home/cohesity/pprof/pprof.10.2.144.87:50048.alloc_objects.alloc_space.inuse_objects.inuse_space.013.pb.gz
Entering interactive mode (type "help" for commands)
(pprof) top
15364.38kB of 18436.46kB total (83.34%)
Showing top 10 nodes out of 30 (cum >= 512.03kB)
      flat  flat%   sum%        cum   cum%
 3584.45kB 19.44% 19.44% 13316.25kB 72.23%  google_golang_org_grpc.Server.serveStreams
 3072.35kB 16.66% 36.11%  3072.35kB 16.66%  golang_org_x_net_http2_hpack.Decoder.parseFieldIndexed
 1536.52kB  8.33% 44.44%  1536.52kB  8.33%  google_golang_org_grpc_transport.decodeState.processHeaderField
 1536.14kB  8.33% 52.77%  4608.77kB 25.00%  google_golang_org_grpc_transport.http2Server.operateHeaders
 1536.12kB  8.33% 61.10%  1536.12kB  8.33%  golang_org_x_net_context.WithDeadline
 1536.05kB  8.33% 69.44%  9731.80kB 52.79%  google_golang_org_grpc_transport.http2Server.HandleStreams
 1024.06kB  5.55% 74.99%  1024.06kB  5.55%  google_golang_org_grpc_transport.loopyWriter.run
  514.63kB  2.79% 77.78%   514.63kB  2.79%  golang_org_x_net_http2_hpack.Decoder.parseFieldLiteral
  512.04kB  2.78% 80.56%  1024.05kB  5.55%  google_golang_org_grpc.Server.sendResponse
  512.03kB  2.78% 83.34%   512.03kB  2.78%  golang_org_x_net_trace.FromContext

A few minutes later:

 go tool pprof --alloc_space http://10.2.144.87:50048/debug/pprof/heap
Fetching profile from http://10.2.144.87:50048/debug/pprof/heap
Saved profile in /home/cohesity/pprof/pprof.10.2.144.87:50048.alloc_objects.alloc_space.inuse_objects.inuse_space.014.pb.gz
Entering interactive mode (type "help" for commands)
(pprof) top
125.01MB of 171.64MB total (72.84%)
Dropped 7 nodes (cum <= 0.86MB)
Showing top 10 nodes out of 58 (cum >= 4.50MB)
      flat  flat%   sum%        cum   cum%
   23.50MB 13.69% 13.69%    86.52MB 50.41%  google_golang_org_grpc_transport.http2Server.HandleStreams
      23MB 13.40% 27.09%   109.52MB 63.81%  google_golang_org_grpc.Server.serveStreams
      17MB  9.91% 37.00%       17MB  9.91%  golang_org_x_net_http2_hpack.Decoder.parseFieldIndexed
   12.50MB  7.28% 44.29%       13MB  7.58%  google_golang_org_grpc_transport.decodeState.processHeaderField
   10.50MB  6.12% 50.40%       55MB 32.05%  google_golang_org_grpc..1google_golang_org_grpc.Server.serveStreams..func2
       9MB  5.24% 55.65%        9MB  5.24%  google_golang_org_grpc_transport.controlBuffer.put
    8.50MB  4.95% 60.60%       13MB  7.57%  golang_org_x_net_context.WithTimeout
    8.50MB  4.95% 65.55%       40MB 23.31%  google_golang_org_grpc.Server.handleStream
       8MB  4.66% 70.21%    31.50MB 18.35%  google_golang_org_grpc.Server.processUnaryRPC
    4.50MB  2.62% 72.84%     4.50MB  2.62%  golang_org_x_net_trace.FromContext
@gopherbot gopherbot added this to the Gccgo milestone Apr 26, 2018
@agnivade agnivade added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 26, 2018
@bcmills
Copy link
Contributor

bcmills commented Apr 26, 2018

In server.go, you have

  // This call enables profiling of goroutine blocks for pprof.
  // https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs
  runtime.SetBlockProfileRate(1)

Do you still observe the memory growth if you remove that?

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 26, 2018
@gopherbot
Copy link

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.)

@golang golang locked and limited conversation to collaborators May 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants