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

runtime/race: support core dumps in race mode #16527

Closed
patricksuo opened this issue Jul 28, 2016 · 8 comments
Closed

runtime/race: support core dumps in race mode #16527

patricksuo opened this issue Jul 28, 2016 · 8 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@patricksuo
Copy link

patricksuo commented Jul 28, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version go1.7beta1 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/supei/project/jx3m/Server/go"
GORACE=""
GOROOT="/home/supei/goroot"
GOTOOLDIR="/home/supei/goroot/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build144261612=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?
    get or set resource limit via system call.

https://play.golang.org/p/ZEsI1Xxyqi

  1. What did you expect to see?
    same core size limit
  2. What did you see instead?
without -race 
rlimit core: 0 18446744073709551615
with
rlimit core: 0 0
@davecheney
Copy link
Contributor

What is the output you get under the race detector.

On Thu, Jul 28, 2016 at 11:23 PM, su21 notifications@github.com wrote:

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?
go version go1.7beta1 linux/amd64
2.

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/supei/project/jx3m/Server/go"
GORACE=""
GOROOT="/home/supei/goroot"
GOTOOLDIR="/home/supei/goroot/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build144261612=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do? get and set resource limit via system call.

https://play.golang.org/p/ZEsI1Xxyqi

  1. What did you expect to see? get different result with -race


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#16527, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAcAybak5cHS4lzUpMzzJKQ9dhOpgucks5qaK1KgaJpZM4JXNMn
.

@patricksuo
Copy link
Author

without -race
rlimit core: 0 18446744073709551615

with
rlimit core: 0 0

@patricksuo
Copy link
Author

patricksuo commented Jul 28, 2016

strace.txt
It calls setrlimit somewhere.

0000000000459700 <_ZN11__sanitizer28DisableCoreDumperIfNecessaryEv>:
  459700:       48 8d 05 19 db 0a 00    lea    0xadb19(%rip),%rax        # 507220 <_ZN11__sanitizer21common_flags_dont_useE>
  459707:       80 b8 8b 00 00 00 00    cmpb   $0x0,0x8b(%rax)
  45970e:       75 08                   jne    459718 <_ZN11__sanitizer28DisableCoreDumperIfNecessaryEv+0x18>
  459710:       c3                      retq
  459711:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
  459718:       48 83 ec 18             sub    $0x18,%rsp
  45971c:       bf 04 00 00 00          mov    $0x4,%edi
  459721:       48 89 e6                mov    %rsp,%rsi
  459724:       48 c7 04 24 00 00 00    movq   $0x0,(%rsp)
  45972b:       00
  45972c:       48 c7 44 24 08 00 00    movq   $0x0,0x8(%rsp)
  459733:       00 00
  459735:       e8 c6 e5 01 00          callq  477d00 <setrlimit@plt>
  45973a:       85 c0                   test   %eax,%eax
  45973c:       75 05                   jne    459743 <_ZN11__sanitizer28DisableCoreDumperIfNecessaryEv+0x43>
  45973e:       48 83 c4 18             add    $0x18,%rsp
  459742:       c3                      retq
  459743:       e8 f0 d4 01 00          callq  476c38 <_ZN11__sanitizerL6setlimEim.part.59>
  459748:       0f 1f 84 00 00 00 00    nopl   0x0(%rax,%rax,1)
  45974f:       00

@patricksuo patricksuo changed the title system call syscall.Getrlimit broken with -race flag race detector disable core dump Jul 29, 2016
@quentinmit
Copy link
Contributor

That code comes from the sanitizer library (see https://github.com/llvm-mirror/compiler-rt/blob/929d23ef5045d955ef2c36f2bbdb3dc61eca518f/lib/sanitizer_common/sanitizer_posix_libcdep.cc#L90)

The documentation for that flag says:

Disable core dumping. By default, disable_core=1 on 64-bit to avoid dumping a 16T+ core file. Ignored on OSes that don't dump core by default and for sanitizers that don't reserve lots of virtual memory.

Given that comment, it seems like it would be difficult or impossible to fix this.

@quentinmit quentinmit added this to the Go1.8Maybe milestone Aug 1, 2016
@mdempsky
Copy link
Member

mdempsky commented Aug 1, 2016

It looks like Linux 3.4 added a MADV_DONTDUMP flag that can be used to omit memory from core dumps, so compiler-rt could potentially use that to avoid needing to disable core dumps altogether.

@tombergan
Copy link
Contributor

I believe this is WAI. Set GORACE='disable_coredump=0' in your environment if you want coredumps with the race detector:

$ cat https://play.golang.org/p/ZEsI1Xxyqi > main.go
$ go run main.go
rlimit core: 0 18446744073709551615
$ go run -race main.go
rlimit core: 0 0
$ GORACE='disable_coredump=0' go run -race main.go
rlimit core: 0 18446744073709551615

@quentinmit quentinmit changed the title race detector disable core dump runtime/race: support core dumps in race mode Oct 10, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@gopherbot
Copy link

CL https://golang.org/cl/31650 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/32160 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants