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: crash in time.Sleep when killing a process #28874

Closed
subbu05 opened this Issue Nov 19, 2018 · 9 comments

Comments

Projects
None yet
6 participants
@subbu05
Copy link

subbu05 commented Nov 19, 2018

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

$ go version
go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

go version go1.11.1 linux/amd64

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

Centos
Linux 2.6.32-754.6.3.el6.x86_64 #1 SMP Tue Oct 9 17:27:49 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cloudera/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/cloudera/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/golang"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build763489511=/tmp/go-build"

What did you do?

Go program was running. After few seconds killed the go process using kill -9

func main(){
	for i:=0;i<1000;i++{
		err:=ioutil.WriteFile("a1.dat",[]byte(time.Now().String()),0644)
		if err != nil {
			panic(err)
		}
		time.Sleep(time.Second)
	}
}

What did you expect to see?

Go process must be killed without any error.

What did you see instead?

SIGFPE: floating-point exception
PC=0x4531c3 m=0 sigcode=0

goroutine 4 [syscall]:
runtime.notetsleepg(0x53f060, 0x3b9aa802, 0x1)
/usr/lib/golang/src/runtime/lock_futex.go:227 +0x37 fp=0xc000035f58 sp=0xc000035f28 pc=0x4095e7
runtime.timerproc(0x53f040)
/usr/lib/golang/src/runtime/time.go:288 +0x30e fp=0xc000035fd8 sp=0xc000035f58 pc=0x442e5e
runtime.goexit()
/usr/lib/golang/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000035fe0 sp=0xc000035fd8 pc=0x451371
created by runtime.(*timersBucket).addtimerLocked
/usr/lib/golang/src/runtime/time.go:170 +0x114

goroutine 1 [sleep]:
time.Sleep(0x3b9aca00)
/usr/lib/golang/src/runtime/time.go:105 +0x14f
main.main()
/home/cloudera/go/src/github.com/filechecker/main.go:23 +0x32

rax 0xfffffffffffffffc
rbx 0x3b9aa802
rcx 0xffffffffffffffff
rdx 0x0
rdi 0x53f060
rsi 0x80
rbp 0xc000035ee0
rsp 0xc000035e98
r8 0x0
r9 0x0
r10 0xc000035ed0
r11 0x202
r12 0xc
r13 0x32
r14 0x4be4d6
r15 0x0
rip 0x4531c3
rflags 0x202
cs 0x33
fs 0x0
gs 0x0

@OneOfOne

This comment has been minimized.

Copy link
Contributor

OneOfOne commented Nov 20, 2018

I don't think kernels that old are supported, but I could be wrong.

@agnivade

This comment has been minimized.

Copy link
Member

agnivade commented Nov 20, 2018

@OneOfOne - Our minimum kernel version is 2.6.23.

@subbu05 - Are you able to reproduce this consistently ? Would you be able to try with 1.10.5 and see if the same happens ?

@agnivade agnivade changed the title Go process crashed in time.Sleep() runtime: crash in time.Sleep() when killing a process Nov 20, 2018

@agnivade agnivade changed the title runtime: crash in time.Sleep() when killing a process runtime: crash in time.Sleep when killing a process Nov 20, 2018

@agnivade agnivade added this to the Go1.13 milestone Nov 20, 2018

@hongliang5316

This comment has been minimized.

Copy link

hongliang5316 commented Nov 20, 2018

@agnivade
Hello,
I want to know what's the minimum glibc's version?
Thanks

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Nov 20, 2018

@hongliang5316 Pure Go programs don't use glibc at all. There is no particular minimum version of glibc for programs that use cgo, though of course the cgo code may itself require some minimum glibc version.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Nov 20, 2018

The bug report says you used kill -9, but that should cause the Go program to die without printing anything. Can you confirm the exact command you used to cause this error? Is this problem repeatable?

@subbu05

This comment has been minimized.

Copy link
Author

subbu05 commented Nov 20, 2018

@ianlancetaylor
While the go process is running (which had statements to write to file and sleep for 1 second), I intentionally killed the go process using kill -9
It happened few times but not consistent. I will try to reproduce the issue again.

@subbu05

This comment has been minimized.

Copy link
Author

subbu05 commented Nov 20, 2018

@agnivade
Sure I will try with 1.10.5 go version and update the status.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Nov 20, 2018

kill -9 kills a process immediately without letting it do anything else. I don't see how you could see this kind of output when using kill -9; I don't see how you could see any output at all. Unless I deeply misunderstand how kill -9 works. Maybe kill -9 acts differently on multi-threaded programs on GNU/Linux? Since you are running such an old kernel, maybe it used to act differently? I don't really know.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Dec 21, 2018

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

@gopherbot gopherbot closed this Dec 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.