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

Out Of Memory failures for staticcheck on travis (GOGC=5, concurrency=1) #712

Closed
katbyte opened this issue Sep 18, 2019 · 2 comments
Closed
Labels
duplicate This issue or pull request already exists topic: memory Huge memory consumption
Milestone

Comments

@katbyte
Copy link

katbyte commented Sep 18, 2019

After working fine for 6ish months we have had to disable static-check linter on the terraform azure provider as we were unable to get it to finish anymore in travis due to it running out of memory. We have set concurrency to 1 and GOGC=5.

Please include the following information:

  1. Version of golangci-lint: golangci-lint --version (or git commit if you don't use binary distribution)
    travis does a GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint each run

  2. Config file: cat .golangci.yml

GOGC=5 (while true; do sleep 300; echo "(Hey travis! I'm still alive and linting)"; done) & PID=$$!; echo $$PID; \
	golangci-lint run ./... -v --no-config --concurrency 1 --deadline=30m10s --disable-all --enable=staticcheck; ES=$$?; kill -9 $$PID; exit $$ES
  1. Go environment: go version && go env
    travis:
dist: xenial
sudo: required
services:
- docker
language: go
go:
- "1.13.x"

branches:
  only:
    - master

env:
  global:
    GOFLAGS=-mod=vendor
  1. Verbose output of running: golangci-lint run -v
$ gimme version
v1.5.3
$ go version
go version go1.13 linux/amd64
go.env
$ go env
install.1
0.58s$ bash scripts/gogetcookie.sh
install.2
34.84s$ make tools
1062.78s$ GOGC=5 make lintstatic
==> Checking source code against static check linters...
(while true; do sleep 300; echo "(Hey travis! I'm still alive and linting)"; done) & PID=$!; echo $PID; \
golangci-lint run ./... -v --no-config --concurrency 1 --deadline=30m10s --disable-all --enable=staticcheck; ES=$?; kill -9 $PID; exit $ES
5553
INFO [lintersdb] Active 1 linters: [staticcheck]  
(Hey travis! I'm still alive and linting)
(Hey travis! I'm still alive and linting)
INFO [loader] Go packages loading at mode 575 (types_sizes|deps|exports_file|imports|compiled_files|files|name) took 11m1.095392691s 
(Hey travis! I'm still alive and linting)
fatal error: runtime: out of memory
runtime stack:
runtime.throw(0xf2afad, 0x16)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/panic.go:774 +0x72
runtime.sysMap(0xc1a4000000, 0x4000000, 0x18a0358)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/mem_linux.go:169 +0xc5
runtime.(*mheap).sysAlloc(0x187dd80, 0x2000, 0x41f392, 0x7f555fde6008)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/malloc.go:701 +0x1cd
runtime.(*mheap).grow(0x187dd80, 0x1, 0xffffffff)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/mheap.go:1252 +0x42
runtime.(*mheap).allocSpanLocked(0x187dd80, 0x1, 0x18a0368, 0xc000055320)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/mheap.go:1163 +0x291
runtime.(*mheap).alloc_m(0x187dd80, 0x1, 0x7f555cc0000e, 0x45a12a)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/mheap.go:1015 +0xc2
runtime.(*mheap).alloc.func1()
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/mheap.go:1086 +0x4c
runtime.systemstack(0x7fff0cb74220)
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/asm_amd64.s:370 +0x66
runtime.mstart()
	/home/travis/.gimme/versions/go1.13.linux.amd64/src/runtime/proc.go:1146
jirfag added a commit that referenced this issue Sep 23, 2019
Set analysis pass results to nil early to garbage collect them
soon.
Memory can be reduced for the following linters:
  - staticcheck
  - stylecheck
  - gosimple
  - govet
  - bodyclose
  - any future go/analysis linter

Relates: #712, #634, #628, #598, #509, #483, #337
jirfag added a commit that referenced this issue Sep 23, 2019
Set analysis pass results to nil early to garbage collect them
soon.
Memory can be reduced for the following linters:
  - staticcheck
  - stylecheck
  - gosimple
  - govet
  - bodyclose
  - any future go/analysis linter

Relates: #712, #634, #628, #598, #509, #483, #337
@jirfag
Copy link
Member

jirfag commented Sep 23, 2019

Hi!
Please, try the latest version from the master. I've reduced memory usage of staticcheck on your repo from 8GB to 2GB.

@jirfag jirfag added the topic: memory Huge memory consumption label Sep 24, 2019
@jirfag jirfag added this to the v1.20.0 milestone Sep 24, 2019
@jirfag
Copy link
Member

jirfag commented Sep 25, 2019

let's continue in #337, there are too many similar issues about memory

@jirfag jirfag closed this as completed Sep 25, 2019
@tpounds tpounds added the duplicate This issue or pull request already exists label Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists topic: memory Huge memory consumption
Projects
None yet
Development

No branches or pull requests

3 participants