golang/go

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

Aperta

#28.024 aperta il 4 ott 2018

 (12 commenti) (0 reazioni) (0 assegnatari)Go (19.008 fork)batch import
NeedsInvestigationOS-Darwinhelp wanted

Metriche repository

Star
 (133.883 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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?

Guida contributor