golang/go

runtime/cgo: -extldflags=-stack_size=NNN does not set stack size used by runtime/cgo

Offen

#28.024 geöffnet am 04.10.2018

 (12 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Go (19.008 Forks)batch import
NeedsInvestigationOS-Darwinhelp wanted

Repository-Metriken

Stars
 (133.883 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 darwin/amd64 macOS Sierra (10.12.6)

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/p8a/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/p8a/data/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
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=/var/folders/5l/3qmpjt5s6_z0vhkj27l7v0p40000gr/T/go-build878210713=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Integrating via cgo a 3rd-party library which requires 2mb stack space does not work because stack size is set to default PTHREAD_STACK_MIN (which is less).

The runtime behavior manifests as a deadlocked "panic" call with the following stack:

2359 Thread_1644947
    + 2359 _sigtramp  (in libsystem_platform.dylib) + 26  [0x7fff9656cb3a]
    +   2359 runtime.sigtramp  (in test) + 51  [0x4065fe3]
    +     2359 runtime.sigtrampgo  (in test) + 544  [0x4049000]
    +       2359 runtime.sighandler  (in test) + 1788  [0x404866c]
    +         2359 runtime.(*sigctxt).preparePanic  (in test) + 172  [0x40475fc]

What did you expect to see?

Panic being triggered and a way to set cgo stack size.

What did you see instead?

Contributor Guide