-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.8 darwin/amd64
(Note that the actual crash occurs on Android 7.0 and higher)
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rayvbr/Dropbox/Development/Go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/k7/jx2bs5q170z4lvdzbsdt426r0000gn/T/go-build687164964=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
- Create simple go file with main.go only including log.fmt("This is a log")
- Compile with 'gomobile bind -target android -o test.aar'
- Import resulting test.aart in Unity
- Build project and run on Android 7.0 or higher
What did you expect to see?
"This is a log" being printed to console
On Android versions lower than 7.0 this works.
On Android 7.0 without using Unity, it works as well
It is only the combination of Unity and Android 7.0 and up that causes the issue below.
What did you see instead?
Crash with 'could not find pthread key'.
03-02 09:26:39.279 14186-14186/? A/DEBUG: Revision: '8'
03-02 09:26:39.279 14186-14186/? A/DEBUG: ABI: 'arm'
03-02 09:26:39.279 14186-14186/? A/DEBUG: pid: 14049, tid: 14185, name: Thread-18 >>> com.xxx.yyy <<<
03-02 09:26:39.279 14186-14186/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
03-02 09:26:39.289 14186-14186/? A/DEBUG: Abort message: 'could not find pthread key'
03-02 09:26:39.289 14186-14186/? A/DEBUG: r0 00000000 r1 00003769 r2 00000006 r3 0000000
03-02 09:26:39.289 14186-14186/? A/DEBUG: r4 b32fe978 r5 00000006 r6 b32fe920 r7 0000010c
03-02 09:26:39.289 14186-14186/? A/DEBUG: r8 b2ae47f0 r9 00000000 sl b2ae4280 fp b32fe82c
03-02 09:26:39.289 14186-14186/? A/DEBUG: ip 00000000 sp b32fe7a8 lr e72d995 pc e72dc1c0 cpsr 600f0010
03-02 09:26:39.303 14186-14186/? A/DEBUG: backtrace:
03-02 09:26:39.303 14186-14186/? A/DEBUG: #00 pc 0004a1c0 /system/lib/libc.so (tgkill+12)
03-02 09:26:39.304 14186-14186/? A/DEBUG: #1 pc 00047953 /system/lib/libc.so (pthread_kill+34)
03-02 09:26:39.304 14186-14186/? A/DEBUG: #2 pc 0001d955 /system/lib/libc.so (raise+10)
03-02 09:26:39.304 14186-14186/? A/DEBUG: #3 pc 000194a1 /system/lib/libc.so (__libc_android_abort+34)
03-02 09:26:39.304 14186-14186/? A/DEBUG: #4 pc 000170e8 /system/lib/libc.so (abort+4)
03-02 09:26:39.304 14186-14186/? A/DEBUG: #5 pc 003f724c /data/app/com.xxx.yyy/lib/arm/libgojni.so (fatalf+212)
03-02 09:26:41.179 3245-3245/? E/audit: type=1701 audit(1488443201.174:997): auid=4294967295 uid=10260 gid=10260 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=14185 comm="Thread-18" exe="/system/bin/app_process32" sig=6`
Possible solution
Setting PTHREAD_KEYS_MAX in src/runtime/cgo/gcc_android_arm.c to 384 instead of 128 (and removing the surrounding #ifndef), seems to resolve the issue