hajimehoshi / ebiten

Ebitengine - A dead simple 2D game engine for Go
https://ebitengine.org
Apache License 2.0
11.06k stars 662 forks source link

go-inovation sometimes crashes #457

Closed hajimehoshi closed 6 years ago

hajimehoshi commented 6 years ago
2017-12-06 23:48:26.692980+0900 goinovation[340:12950] [DYMTLInitPlatform] platform initialization successful
2017-12-06 23:48:27.005907+0900 goinovation[340:12878] libMobileGestalt MobileGestaltSupport.m:153: pid 340 (goinovation) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-12-06 23:48:27.006045+0900 goinovation[340:12878] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
runtime: writebarrierptr *0x100476558 = 0x18
fatal error: bad pointer in write barrier

runtime stack:
runtime.throw(0x1002518fe, 0x1c)
    /usr/local/go/src/runtime/panic.go:605 +0x70
runtime.writebarrierptr.func1()
    /usr/local/go/src/runtime/mbarrier.go:213 +0xa4
runtime.systemstack(0x106a38000)
    /usr/local/go/src/runtime/asm_arm64.s:241 +0x8c
runtime.mstart()
    /usr/local/go/src/runtime/proc.go:1135

goroutine 19 [running]:
runtime.systemstack_switch()
    /usr/local/go/src/runtime/asm_arm64.s:190 +0x8 fp=0x106a3edb0 sp=0x106a3eda0 pc=0x10013e9f0
runtime.writebarrierptr(0x100476558, 0x18)
    /usr/local/go/src/runtime/mbarrier.go:211 +0x7c fp=0x106a3ede0 sp=0x106a3edb0 pc=0x100102064
golang.org/x/mobile/exp/audio/al.OpenDevice(0x0, 0x0)
    /Users/hajimehoshi/go/src/golang.org/x/mobile/exp/audio/al/alc.go:53 +0x110 fp=0x106a3ee30 sp=0x106a3ede0 pc=0x1001a6ec8
github.com/hajimehoshi/oto.newPlayer(0xac44, 0x2, 0x2, 0x2274, 0x106a2e0c0, 0x0, 0x100495501)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/oto/player_ios.go:55 +0x18 fp=0x106a3eed0 sp=0x106a3ee30 pc=0x1001a89e0
github.com/hajimehoshi/oto.NewPlayer(0xac44, 0x2, 0x2, 0x2274, 0x0, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/oto/player.go:49 +0x38 fp=0x106a3ef20 sp=0x106a3eed0 pc=0x1001a85c0
github.com/hajimehoshi/ebiten/audio.(*Context).loop(0x106a96190)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/audio/audio.go:246 +0x118 fp=0x106a3efd0 sp=0x106a3ef20 pc=0x1001aa440
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:931 +0x4 fp=0x106a3efd0 sp=0x106a3efd0 pc=0x100140cfc
created by github.com/hajimehoshi/ebiten/audio.NewContext
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/audio/audio.go:205 +0x12c

goroutine 4 [runnable]:
compress/flate.(*decompressor).moreBits(0x106a3a600, 0x106a3ae50, 0xe)
    /usr/local/go/src/compress/flate/inflate.go:693 +0xf4
compress/flate.(*decompressor).huffmanBlock(0x106a3a600)
    /usr/local/go/src/compress/flate/inflate.go:578 +0x454
compress/flate.(*decompressor).nextBlock(0x106a3a600)
    /usr/local/go/src/compress/flate/inflate.go:327 +0x1ac
compress/flate.(*decompressor).Read(0x106a3a600, 0x107c14505, 0x2bc, 0x2bc, 0x105, 0x0, 0x0)
    /usr/local/go/src/compress/flate/inflate.go:347 +0x54
compress/zlib.(*reader).Read(0x106a961e0, 0x107c14505, 0x2bc, 0x2bc, 0x105, 0x0, 0x0)
    /usr/local/go/src/compress/zlib/reader.go:94 +0x58
io.ReadAtLeast(0x126a941c8, 0x106a961e0, 0x107c14400, 0x3c1, 0x3c1, 0x3c1, 0x3c1, 0x1001d7190, 0x0)
    /usr/local/go/src/io/io.go:309 +0x70
io.ReadFull(0x126a941c8, 0x106a961e0, 0x107c14400, 0x3c1, 0x3c1, 0x3c0, 0x3, 0x0)
    /usr/local/go/src/io/io.go:327 +0x44
image/png.(*decoder).readImagePass(0x107398000, 0x126a941c8, 0x106a961e0, 0x0, 0x106a96100, 0x0, 0x100000000, 0x106b06000, 0x107398078)
    /usr/local/go/src/image/png/reader.go:502 +0x3ac
image/png.(*decoder).decode(0x107398000, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/image/png/reader.go:365 +0x3fc
image/png.(*decoder).parseIDAT(0x107398000, 0x2000, 0x10024d10b, 0x4)
    /usr/local/go/src/image/png/reader.go:839 +0x28
image/png.(*decoder).parseChunk(0x107398000, 0x0, 0x0)
    /usr/local/go/src/image/png/reader.go:899 +0x370
image/png.Decode(0x10030c120, 0x106aa02a0, 0x106aa02a0, 0x10030c120, 0x106aa02a0, 0x8)
    /usr/local/go/src/image/png/reader.go:958 +0x11c
image.Decode(0x10030c1a0, 0x106a82a20, 0x1003246a0, 0xc279, 0xc279, 0x0, 0x0, 0x107396000)
    /usr/local/go/src/image/format.go:84 +0xbc
github.com/hajimehoshi/go-inovation/ino.(*Game).loadImages(0x106afa000, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/game.go:200 +0x14c
github.com/hajimehoshi/go-inovation/ino.NewGame.func1(0x106afa000)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/game.go:238 +0x20
created by github.com/hajimehoshi/go-inovation/ino.NewGame
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/game.go:237 +0xd4

goroutine 17 [select, locked to thread]:
github.com/hajimehoshi/ebiten/internal/opengl.(*Context).DoWork(0x106afa050, 0x106a2e240, 0x106a7c180, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/internal/opengl/context_mobile.go:95 +0xf4
github.com/hajimehoshi/ebiten/internal/ui.Render(0x106a2e240, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/internal/ui/ui_mobile.go:42 +0x170
github.com/hajimehoshi/ebiten/mobile.update(0x0, 0x106a18600)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/mobile/impl_mobile.go:38 +0xac
github.com/hajimehoshi/ebiten/mobile.Update(0x106a39370, 0x106a39370)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/mobile/mobile.go:45 +0x18
github.com/hajimehoshi/go-inovation/mobile.Update(0x0, 0x100116d18)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/mobile/mobile.go:34 +0x18
_/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-349791869/src/gomobile_bind.proxymobile__Update(0x100000008)
    /var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-349791869/src/gomobile_bind/go_mobilemain.go:47 +0x18
_/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-349791869/src/gomobile_bind._cgoexpwrap_223292fa2c88_proxymobile__Update(0x16fd104d0)
    _/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-349791869/src/gomobile_bind/_obj/_cgo_gotypes.go:197 +0x18

goroutine 20 [syscall]:
os/signal.signal_recv(0x0)
    /usr/local/go/src/runtime/sigqueue.go:131 +0xc8
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.0
    /usr/local/go/src/os/signal/signal_unix.go:28 +0x30

goroutine 21 [select, locked to thread]:
runtime.gopark(0x100258248, 0x0, 0x10024d49c, 0x6, 0x18, 0x1)
    /usr/local/go/src/runtime/proc.go:287 +0xe8
runtime.selectgo(0x106a3ff50, 0x106a7c300)
    /usr/local/go/src/runtime/select.go:395 +0xcd4
runtime.ensureSigM.func1()
    /usr/local/go/src/runtime/signal_unix.go:511 +0x1c0
runtime.goexit()
    /usr/local/go/src/runtime/asm_arm64.s:931 +0x4

goroutine 5 [runnable]:
github.com/hajimehoshi/go-mp3/internal/huffman.Decode(0x10738f500, 0x2, 0x1, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-mp3/internal/huffman/huffman.go:348 +0x6b8
github.com/hajimehoshi/go-mp3/internal/maindata.readHuffman(0x10738f500, 0xfffb6064, 0x107320580, 0x106d2e000, 0x40c, 0x1, 0x0, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-mp3/internal/maindata/huffman.go:71 +0x160
github.com/hajimehoshi/go-mp3/internal/maindata.Read(0x1275d80d0, 0x106afc1e0, 0x10738f4d0, 0x1fffb6064, 0x107320580, 0x0, 0x0, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-mp3/internal/maindata/maindata.go:152 +0x248
github.com/hajimehoshi/go-mp3/internal/frame.Read(0x10030c460, 0x106afc1e0, 0x2c3a0, 0x106d24000, 0x106d24000, 0x2c267, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-mp3/internal/frame/frame.go:97 +0x158
github.com/hajimehoshi/go-mp3.NewDecoder(0x1275d8028, 0x106a26028, 0x106a26028, 0x1275d8028, 0x106a26028)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-mp3/decode.go:157 +0x1a0
github.com/hajimehoshi/ebiten/audio/mp3.Decode(0x106a96190, 0x10030d960, 0x106a26028, 0x4, 0xaa401, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/audio/mp3/decode_notjs.go:62 +0x48
github.com/hajimehoshi/go-inovation/ino.loadAudio(0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/audio.go:61 +0x31c
github.com/hajimehoshi/go-inovation/ino.NewGame.func2(0x106afa000)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/game.go:244 +0x18
created by github.com/hajimehoshi/go-inovation/ino.NewGame
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/go-inovation/ino/game.go:243 +0xf4

goroutine 6 [chan receive]:
github.com/hajimehoshi/ebiten/audio.(*Context).ping(0x106a96190)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/audio/audio.go:223 +0x34
github.com/hajimehoshi/ebiten/audio.(*Context).(github.com/hajimehoshi/ebiten/audio.ping)-fm()
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/audio/audio.go:237 +0x20
github.com/hajimehoshi/ebiten/internal/clock.Update(0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/internal/clock/clock.go:82 +0x24c
github.com/hajimehoshi/ebiten.(*updater).Update(0x106a26010, 0x100257d50, 0xf0, 0x4009000000000000)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/run.go:88 +0x44
github.com/hajimehoshi/ebiten/internal/ui.(*userInterface).update(0x10030bb20, 0x10030d8e0, 0x106a26010, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/internal/ui/ui_mobile.go:90 +0x7c
github.com/hajimehoshi/ebiten/internal/ui.Run(0x140, 0xf0, 0x3ff5555555555555, 0x1002513fe, 0x1b, 0x10030d8e0, 0x106a26010, 0x10022fb00, 0xffffffffffffffff)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/internal/ui/ui_mobile.go:72 +0x16c
github.com/hajimehoshi/ebiten.run(0x140, 0xf0, 0x3ff5555555555555, 0x1002513fe, 0x1b, 0x106afc030, 0x0, 0x0)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/run.go:65 +0x7c
github.com/hajimehoshi/ebiten.RunWithoutMainLoop.func1(0x106a2e240, 0x106a28030, 0x140, 0xf0, 0x3ff5555555555555, 0x1002513fe, 0x1b)
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/run.go:154 +0xc0
created by github.com/hajimehoshi/ebiten.RunWithoutMainLoop
    /Users/hajimehoshi/go/src/github.com/hajimehoshi/ebiten/run.go:149 +0x78
hajimehoshi commented 6 years ago

Hm, I've seen a similar problems of pointers

hajimehoshi commented 6 years ago

https://github.com/golang/go/issues/15075

Let's update golang.org/x/mobile on my local machine and wait and see

hajimehoshi commented 6 years ago

Now I don't see this problem any longer

hajimehoshi commented 6 years ago

Now oto uses OpenAL directly (https://github.com/hajimehoshi/oto/commit/d4b1ffefe8ee38086b29aa10d1cf2a86263101b7), this problem should never happen.