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

Processes core dump on SIGPIPE (fatal: morestack on g0) #40076

Closed
jrick opened this issue Jul 6, 2020 · 4 comments
Closed

Processes core dump on SIGPIPE (fatal: morestack on g0) #40076

jrick opened this issue Jul 6, 2020 · 4 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@jrick
Copy link
Contributor

jrick commented Jul 6, 2020

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

$ go version
go version go1.15beta1 openbsd/amd64
$ gover 1.14.4 version
go version go1.14.4 openbsd/amd64
$ /usr/local/bin/go version # from openbsd packages
go version go1.13.9 openbsd/amd64

(gover is https://git.sr.ht/~qbit/gover, a fork of gotip but to build releases from source instead of the binary distribution.)

Does this issue reproduce with the latest release?

Yes, and 1.15beta1, but not 1.13.9.

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

$ dmesg | head -2
OpenBSD 6.7-current (GENERIC.MP) #325: Sun Jul  5 09:05:56 MDT 2020
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jrick/.cache/go-build"
GOENV="/home/jrick/.config/go/env"
GOEXE=""
GOFLAGS="-tags=netgo -ldflags=-extldflags=-static"
GOHOSTARCH="amd64"
GOHOSTOS="openbsd"
GOINSECURE=""
GOMODCACHE="/home/jrick/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="openbsd"
GOPATH="/home/jrick/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jrick/src/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jrick/src/go/pkg/tool/openbsd_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build216704365=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ cat yes.go
package main

import "fmt"

func main() {
        for {
                fmt.Println("y")
        }
}
$ go build yes.go
$ ./yes | missingcommand
ksh: missingcommand: not found
fatal: morestack on g0
Trace/BPT trap (core dumped)
$ gover 1.14.4 build yes.go
$ ./yes | missingcommand
ksh: missingcommand: not found
fatal: morestack on g0
Trace/BPT trap (core dumped) 
$ /usr/local/bin/go build yes.go
$ ./yes | missingcommand
ksh: missingcommand: not found

What did you expect to see?

Clean exit when process is killed by SIGPIPE.

What did you see instead?

Core dumps.

Debugging a 1.14.4 core:

$ gdb ./yes yes.core                                                           
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd6.7"...
(no debugging symbols found)

Core was generated by `yes'.
Program terminated with signal 5, Trace/breakpoint trap.
#0  0x0000000000459b12 in runtime.abort ()
(gdb) bt
#0  0x0000000000459b12 in runtime.abort ()
#1  0x0000000000458335 in runtime.morestack ()
#2  0x000000000042c1cf in runtime.raise ()
#3  0x00000000004425db in runtime.dieFromSignal ()
#4  0x000000000000000d in ?? ()
#5  0x00000043ffffffff in ?? ()
#6  0x000000c000009a60 in ?? ()
#7  0x0000000000442a3e in runtime.sigfwdgo ()
#8  0x000000000000000d in ?? ()
#9  0x0000000000000000 in ?? ()
(gdb)
@ianlancetaylor ianlancetaylor self-assigned this Jul 6, 2020
@ianlancetaylor
Copy link
Contributor

The fix looks easy but I don't understand why the existing tests are passing.

@ianlancetaylor ianlancetaylor added this to the Go1.15 milestone Jul 6, 2020
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 6, 2020
@gopherbot
Copy link

Change https://golang.org/cl/241121 mentions this issue: runtime: mark OpenBSD raise function nosplit

@networkimprov
Copy link

Backport candidate?

@ianlancetaylor
Copy link
Contributor

Doesn't seem too serious to me. The program is going to exit either way. I'm willing to hear other opinions.

@golang golang locked and limited conversation to collaborators Jul 9, 2021
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

4 participants