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: "pipe failed with -89" at program startup(mipsle only), timer related netpoll init. #37997

Closed
xtaci opened this issue Mar 22, 2020 · 14 comments

Comments

@xtaci
Copy link

@xtaci xtaci commented Mar 22, 2020

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

$ go version
go version go1.14.1 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

mipsle

go env Output
$ go env

What did you do?

What did you expect to see?

proper startup

What did you see instead?

root@weiw-e4200:/opt/bin/a# ./client_linux_mipsle.0322 --help
NAME:
kcptun - client(with SMUX)

USAGE:
client_linux_mipsle.0322 [global options] command [command options] [arguments...]

VERSION:
20200322

COMMANDS:
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--localaddr value, -l value local listen address (default: ":12948")
--remoteaddr value, -r value kcp server address (default: "vps:29900")
--key value pre-shared secret between client and server (default: "it's a secrect") [$KCPTUN_KEY]
--crypt value aes, aes-128, aes-192, salsa20, blowfish, twofish, cast5, 3des, tea, xtea, xor, sm4, none (default: "aes")
--mode value profiles: fast3, fast2, fast, normal, manual (default: "fast")
--conn value

runtime: pipe failed with -89
fatal error: runtime: pipe failed

goroutine 6 [running]:
runtime.throw(0x40afd2, 0x14)
/usr/local/go/src/runtime/panic.go:1114 +0x60 fp=0xc285d0 sp=0xc285bc pc=0x4cd0c
runtime.netpollinit()
/usr/local/go/src/runtime/netpoll_epoll.go:40 +0x20c fp=0xc28608 sp=0xc285d0 pc=0x489a0
runtime.netpollGenericInit()
/usr/local/go/src/runtime/netpoll.go:112 +0xa0 fp=0xc28610 sp=0xc28608 pc=0x46cf4
runtime.doaddtimer(0xc1e000, 0xc3e884)
/usr/local/go/src/runtime/time.go:271 +0x1e8 fp=0xc2863c sp=0xc28610 pc=0x756a0
runtime.addInitializedTimer(0xc3e884)
/usr/local/go/src/runtime/time.go:258 +0x8c fp=0xc28658 sp=0xc2863c pc=0x75480
runtime.addtimer(0xc3e884)
/usr/local/go/src/runtime/time.go:248 +0x88 fp=0xc28664 sp=0xc28658 pc=0x753c4
time.startTimer(0xc3e884)
/usr/local/go/src/runtime/time.go:207 +0x3c fp=0xc2866c sp=0xc28664 pc=0x751c4
time.NewTimer(0x0, 0x0, 0x0)
/usr/local/go/src/time/sleep.go:93 +0xf8 fp=0xc28690 sp=0xc2866c pc=0xead00
github.com/xtaci/kcp-go/v5.(*TimedSched).sched(0xc48060)
/home/xtaci/go/pkg/mod/github.com/xtaci/kcp-go/v5@v5.5.11/timedsched.go:64 +0x5c fp=0xc287e4 sp=0xc28690 pc=0x225f28
runtime.goexit()
/usr/local/go/src/runtime/asm_mipsx.s:651 +0x4 fp=0xc287e4 sp=0xc287e4 pc=0x87d64
created by github.com/xtaci/kcp-go/v5.NewTimedSched
/home/xtaci/go/pkg/mod/github.com/xtaci/kcp-go/v5@v5.5.11/timedsched.go:56 +0x118

goroutine 1 [runnable]:
syscall.Syscall(0xfa4, 0x1, 0xc6c434, 0x5, 0x5, 0x2, 0x0)
/usr/local/go/src/syscall/asm_linux_mipsx.s:17 +0x10
syscall.write(0x1, 0xc6c434, 0x5, 0x8, 0x0, 0x0, 0x0)
/usr/local/go/src/syscall/zsyscall_linux_mipsle.go:914 +0x60
syscall.Write(...)
/usr/local/go/src/syscall/syscall_unix.go:214
internal/poll.(*FD).Write(0xc3e080, 0xc6c434, 0x5, 0x8, 0x0, 0x0, 0x0)
/usr/local/go/src/internal/poll/fd_unix.go:268 +0x174
os.(*File).write(...)
/usr/local/go/src/os/file_unix.go:280
os.(*File).Write(0xc0c0f8, 0xc6c434, 0x5, 0x8, 0x8, 0x0, 0x0)
/usr/local/go/src/os/file.go:153 +0x7c
text/tabwriter.(*Writer).write0(0xc6c420, 0xc6c434, 0x5, 0x8)
/usr/local/go/src/text/tabwriter/tabwriter.go:254 +0x60
text/tabwriter.(*Writer).writeN(0xc6c420, 0xc6c434, 0x8, 0x8, 0xd)
/usr/local/go/src/text/tabwriter/tabwriter.go:268 +0xac
text/tabwriter.(*Writer).writePadding(0xc6c420, 0xf, 0x24, 0x600)
/usr/local/go/src/text/tabwriter/tabwriter.go:293 +0x114
text/tabwriter.(*Writer).writeLines(0xc6c420, 0x0, 0x0, 0x1c, 0xcdcb00)
/usr/local/go/src/text/tabwriter/tabwriter.go:324 +0x30c
text/tabwriter.(*Writer).format(0xc6c420, 0x0, 0x0, 0x1c, 0x0)
/usr/local/go/src/text/tabwriter/tabwriter.go:409 +0x2ec
text/tabwriter.(*Writer).format(0xc6c420, 0x0, 0x0, 0x1d, 0xc53300)
/usr/local/go/src/text/tabwriter/tabwriter.go:403 +0x1f0
text/tabwriter.(*Writer).flushNoDefers(0xc6c420)
/usr/local/go/src/text/tabwriter/tabwriter.go:520 +0xe0
text/tabwriter.(*Writer).flush(0xc6c420, 0x0, 0x0)
/usr/local/go/src/text/tabwriter/tabwriter.go:502 +0x94
text/tabwriter.(*Writer).Flush(...)
/usr/local/go/src/text/tabwriter/tabwriter.go:495
github.com/urfave/cli.printHelpCustom(0x47fa10, 0xc0c0f8, 0x41a1cc, 0x41f, 0x3e4080, 0xc01340, 0x0)
/home/xtaci/go/pkg/mod/github.com/urfave/cli@v1.21.0/help.go:258 +0x3ac
github.com/urfave/cli.printHelp(0x47fa10, 0xc0c0f8, 0x41a1cc, 0x41f, 0x3e4080, 0xc01340)
/home/xtaci/go/pkg/mod/github.com/urfave/cli@v1.21.0/help.go:262 +0x68
github.com/urfave/cli.ShowAppHelp(0xc86210, 0xc86201, 0x40)
/home/xtaci/go/pkg/mod/github.com/urfave/cli@v1.21.0/help.go:143 +0x19c
github.com/urfave/cli.(*App).Run(0xc01340, 0xc0a040, 0x2, 0x2, 0x0, 0x0)
/home/xtaci/go/pkg/mod/github.com/urfave/cli@v1.21.0/app.go:222 +0x8e0
main.main()
/home/xtaci/go/src/github.com/xtaci/kcptun/client/main.go:457 +0x11dc

goroutine 7 [runnable]:
github.com/xtaci/kcp-go/v5.(*TimedSched).prepend(0xc48060)
/home/xtaci/go/pkg/mod/github.com/xtaci/kcp-go/v5@v5.5.11/timedsched.go:100
created by github.com/xtaci/kcp-go/v5.NewTimedSched
/home/xtaci/go/pkg/mod/github.com/xtaci/kcp-go/v5@v5.5.11/timedsched.go:58 +0x154

goroutine 8 [runnable]:
main.sigHandler()
/home/xtaci/go/src/github.com/xtaci/kcptun/client/signal.go:18
created by main.init.0
/home/xtaci/go/src/github.com/xtaci/kcptun/client/signal.go:15 +0x44

@ianlancetaylor ianlancetaylor changed the title "pipe failed with -89" at program startup(mipsle only), timer related netpoll init. runtime: "pipe failed with -89" at program startup(mipsle only), timer related netpoll init. Mar 22, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.15 milestone Mar 22, 2020
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 22, 2020

Please include the actual go env output. Thanks.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 22, 2020

What are the GOARCH and GOOS values that you use to build the failing binary?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 22, 2020

Looks like on MIPS errno value 89 is ENOSYS, so it looks like the problem is that this system does not have the pipe2 system call. The errno value is being returned as a positive number when the code expects a negative number.

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 22, 2020

Change https://golang.org/cl/224592 mentions this issue: runtime: negate errno value for mips pipe/pipe2

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 22, 2020

Can you see if https://golang.org/cl/224592 fixes the problem? Thanks.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 22, 2020

@gopherbot Please open backport for 1.14.

This is a fatal crash with no workaround on mips systems running Linux kernels that do not support pipe2.

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 22, 2020

Backport issue(s) opened: #38005 (for 1.14).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

ianlancetaylor referenced this issue Mar 22, 2020
On MIPS, pipe returns two values rather than taking a pointer.

On MIPS64, call pipe2 rather than pipe.

Also, use the correct system call number for fcntl on mips64.

Change-Id: Ie72acdefeb593f44cb98735fc40eac99cf73509e
Reviewed-on: https://go-review.googlesource.com/c/go/+/202417
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@xtaci
Copy link
Author

@xtaci xtaci commented Mar 23, 2020

the original issue, report by a mipsle user, xtaci/kcptun#771

@xtaci
Copy link
Author

@xtaci xtaci commented Mar 23, 2020

What are the GOARCH and GOOS values that you use to build the failing binary?

the building command:

env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat  go build ...
@xtaci
Copy link
Author

@xtaci xtaci commented Mar 23, 2020

Please include the actual go env output. Thanks.

The building environtment, not the runtime environtment:

╰─$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/xtaci/.cache/go-build"
GOENV="/home/xtaci/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/xtaci/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/xtaci/go/src/github.com/xtaci/kcptun/go.mod"
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-build179104364=/tmp/go-build -gno-record-gcc-switches"

╰─$ uname -a
Linux DESKTOP-7FL7RC4 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

╰─$ go version
go version go1.14.1 linux/amd64
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Mar 23, 2020

Any luck trying the patch above? Thanks.

@xtaci
Copy link
Author

@xtaci xtaci commented Mar 24, 2020

I'll try that

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 25, 2020

Change https://golang.org/cl/225419 mentions this issue: [release-branch.go1.14] runtime: negate errno value for mips pipe/pipe2

gopherbot pushed a commit that referenced this issue Mar 25, 2020
The callers expect negative errno values, so negate them when necessary.

No test because there is no reasonable way to make pipe/pipe2 fail.
This was reported on a system on which pipe2 returned ENOSYS.

For #37997
Fixes #38005

Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508
Reviewed-on: https://go-review.googlesource.com/c/go/+/224592
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
(cherry picked from commit 20b46c7)
Reviewed-on: https://go-review.googlesource.com/c/go/+/225419
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Sep 26, 2020

@sryze This bug is closed and we believe that it is fixed. You may be encountering a different problem with the same symptoms.
Please open a new issue with full details about how to recreate the problem. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.