azul3d / engine

Azul3D - A 3D game engine written in Go!
https://azul3d.org
Other
606 stars 54 forks source link

gfx/gl2: fatal error: concurrent map read and map write #150

Closed nwidger closed 8 years ago

nwidger commented 8 years ago

I'm seeing fatal errors in gfx/gl2 due to the new concurrent map read/write checks added in Go 1.6. This is a stack trace from nintengo:

$ go build && ./nintengo Legend\ of\ Zelda,\ The\ \(U\)\ \(PRG0\)\ \[\!\].nes
2016-03-07 20:27:15.556 nintengo[6890:6875515] 20:27:15.556 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
PRG Banks: 8
CHR Banks: 0
Mirroring: Horizontal
Battery: true
Trainer: false
FourScreen: false
VS Cart: false
RAM Banks: 1
Region: NTSC
Mapper: 1 (MMC1)
*** Loading battery from Legend of Zelda, The (U) (PRG0) [!].sav
fatal error: concurrent map read and map write

goroutine 6 [running, locked to thread]:
runtime.throw(0x47c4c00, 0x21)
    /usr/local/go/src/runtime/panic.go:530 +0x90 fp=0xc820891a48 sp=0xc820891a30
runtime.mapaccess1_faststr(0x4530260, 0xc820069c80, 0x47276e0, 0x5, 0x468a2a0)
    /usr/local/go/src/runtime/hashmap_fast.go:202 +0x5b fp=0xc820891aa8 sp=0xc820891a48
azul3d.org/engine/gfx/gl2.(*device).useState(0xc82081e000, 0xc820494b60, 0xc8201201c0, 0x55a3108, 0xc82009a990)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/draw.go:213 +0x3ad fp=0xc820891c88 sp=0xc820891aa8
azul3d.org/engine/gfx/gl2.(*device).hookedDraw.func1(0xc820891e90)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/draw.go:77 +0x1f7 fp=0xc820891d40 sp=0xc820891c88
azul3d.org/engine/gfx/window.(*glfwWindow).run(0xc8201040b0)
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwwindow.go:647 +0x6e3 fp=0xc820891f98 sp=0xc820891d40
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820891fa0 sp=0xc820891f98
created by azul3d.org/engine/gfx/window.doNew
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwwindow.go:777 +0x4fb

goroutine 1 [chan receive, locked to thread]:
azul3d.org/engine/gfx/window.MainLoop()
    /Users/niels/go/src/azul3d.org/engine/gfx/window/main.go:48 +0x5b
azul3d.org/engine/gfx/window.Run(0xc820492190, 0xc82009a1b0)
    /Users/niels/go/src/azul3d.org/engine/gfx/window/window.go:251 +0xa3
github.com/nwidger/nintengo/nes.(*Azul3DVideo).Run(0xc82008e420)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_video.go:489 +0x10c
github.com/nwidger/nintengo/nes.(*NES).Run(0xc82006a0d0, 0x0, 0x0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:663 +0x4d8
main.main()
    /Users/niels/go/src/github.com/nwidger/nintengo/main.go:83 +0x94e

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 20 [runnable]:
azul3d.org/engine/native/al.(*Device).GetSourcei(0xc8200de300, 0x101600000001, 0xc8204ac03c)
    /Users/niels/go/src/azul3d.org/engine/native/al/al.go:695
github.com/nwidger/nintengo/nes.(*Azul3DAudio).Run(0xc82007c0a0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_audio.go:134 +0x26a
created by github.com/nwidger/nintengo/nes.(*NES).Run
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:625 +0x1b8

goroutine 21 [chan receive]:
github.com/nwidger/nintengo/nes.(*NES).processEvents(0xc82006a0d0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:433 +0x63
created by github.com/nwidger/nintengo/nes.(*NES).Run
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:626 +0x1dd

goroutine 22 [sleep]:
time.Sleep(0x7a1200)
    /usr/local/go/src/runtime/time.go:59 +0xf9
github.com/nwidger/nintengo/nes.(*FPS).Delay(0xc820494c80)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/fps.go:55 +0xf3
github.com/nwidger/nintengo/nes.(*NES).step(0xc82006a0d0, 0xc820120003, 0x0, 0x0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:485 +0x132
github.com/nwidger/nintengo/nes.(*NES).runAsMaster(0xc82006a0d0, 0x0, 0x0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:566 +0x15e
github.com/nwidger/nintengo/nes.(*NES).runProcessors(0xc82006a0d0, 0x0, 0x0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:467 +0x3b
github.com/nwidger/nintengo/nes.(*NES).Run.func1(0xc82006a0d0)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:629 +0x28
created by github.com/nwidger/nintengo/nes.(*NES).Run
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/nes.go:633 +0x202

goroutine 24 [chan receive]:
azul3d.org/engine/gfx/gl2.(*device).hookedRender(0xc82081e000, 0x0, 0x0)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:366 +0xe7
azul3d.org/engine/gfx/gl2.(*device).Render(0xc82081e000)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:168 +0x33
azul3d.org/engine/gfx/internal/util.(*Swapper).Render(0xc820016240)
    /Users/niels/go/src/azul3d.org/engine/gfx/internal/util/swapper.go:91 +0x45
github.com/nwidger/nintengo/nes.(*Azul3DVideo).gfxLoop(0xc82008e420, 0x5559e88, 0xc8201040b0, 0x5559ed8, 0xc820016240)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_video.go:477 +0x1260
github.com/nwidger/nintengo/nes.(*Azul3DVideo).(github.com/nwidger/nintengo/nes.gfxLoop)-fm(0x5559e88, 0xc8201040b0, 0x5559ed8, 0xc820016240)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_video.go:489 +0x48
azul3d.org/engine/gfx/window.Run.func1(0xc82009a1b0, 0xc820492190)
    /Users/niels/go/src/azul3d.org/engine/gfx/window/window.go:247 +0x18a
created by azul3d.org/engine/gfx/window.Run
    /Users/niels/go/src/azul3d.org/engine/gfx/window/window.go:248 +0x9e

goroutine 4 [chan send]:
github.com/nwidger/nintengo/nes.(*Azul3DAudio).stream(0xc82007c0a0, 0xc82008e480)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_audio.go:86 +0xfc
created by github.com/nwidger/nintengo/nes.(*Azul3DAudio).Run
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_audio.go:117 +0xd9

goroutine 25 [select]:
azul3d.org/engine/gfx/gl2.(*device).yield(0xc82006e000)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:306 +0x1ad
created by azul3d.org/engine/gfx/gl2.newDevice
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:452 +0x53a

goroutine 26 [select, locked to thread]:
azul3d.org/engine/gfx/window.assetLoader()
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwinit.go:51 +0x2bc
created by azul3d.org/engine/gfx/window.doInit
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwinit.go:142 +0x277

goroutine 27 [chan receive]:
azul3d.org/engine/gfx/window.pollEvents()
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwinit.go:90 +0x82
created by azul3d.org/engine/gfx/window.doInit
    /Users/niels/go/src/azul3d.org/engine/gfx/window/glfwinit.go:146 +0x2bd

goroutine 5 [select]:
azul3d.org/engine/gfx/gl2.(*device).yield(0xc82081e000)
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:306 +0x1ad
created by azul3d.org/engine/gfx/gl2.newDevice
    /Users/niels/go/src/azul3d.org/engine/gfx/gl2/device.go:452 +0x53a

goroutine 28 [chan receive]:
github.com/nwidger/nintengo/nes.(*Azul3DVideo).gfxLoop.func2(0xc820492318, 0xc820494ac0, 0xc82008e420, 0xc82007ca50)
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_video.go:425 +0x6e
created by github.com/nwidger/nintengo/nes.(*Azul3DVideo).gfxLoop
    /Users/niels/go/src/github.com/nwidger/nintengo/nes/azul3d_video.go:442 +0xcc8
slimsag commented 8 years ago

I have a fix, it was a bug in both nintengo and Azul3D. Will send out soon.

nwidger commented 8 years ago

Excellent, two bugs with one issue, what a deal!

On Mon, Mar 21, 2016, 5:22 AM Stephen Gutekanst notifications@github.com wrote:

I have a fix, it was a bug in both nintengo and Azul3D. Will send out soon.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/azul3d/engine/issues/150#issuecomment-199188705