noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
463 stars 25 forks source link

Custom bot maps crash #608

Open dennwc opened 1 year ago

dennwc commented 1 year ago

opennox_bot_crash.txt

Exception 0xc0000005 0x0 0xacacaeac 0x1a1c408
PC=0x1a1c408
signal arrived during external code execution

runtime.cgocall(0x1acf3a0, 0x19c4d9ac)
        /go/src/runtime/cgocall.go:157 +0x58 fp=0x19c4d998 sp=0x19c4d980 pc=0xe248e8
github.com/noxworld-dev/opennox/v1/legacy/common/ccall._Cfunc_go_call_void_ptr_func(0x1a6ea80, 0x40b1c840)
        _cgo_gotypes.go:1159 +0x2f fp=0x19c4d9ac sp=0x19c4d998 pc=0x124d67f
github.com/noxworld-dev/opennox/v1/legacy/common/ccall.CallVoidPtr.func1(0x1a6ea80, 0x40b1c840)
        /github/workspace/src/legacy/common/ccall/ccall.go:118 +0x4f fp=0x19c4d9c0 sp=0x19c4d9ac pc=0x124d86f
github.com/noxworld-dev/opennox/v1/legacy/common/ccall.CallVoidPtr(0x1a6ea80, 0x40b1c840)
        /github/workspace/src/legacy/common/ccall/ccall.go:118 +0x29 fp=0x19c4d9cc sp=0x19c4d9c0 pc=0x124d809
github.com/noxworld-dev/opennox/v1/legacy.cgoAIAction.Update(...)
        /github/workspace/src/legacy/unit_ai.go:92
github.com/noxworld-dev/opennox/v1/legacy.(*cgoAIAction).Update(0xf9184b0, 0x40b1c840)
        <autogenerated>:1 +0x45 fp=0x19c4d9ec sp=0x19c4d9cc pc=0x139f395
github.com/noxworld-dev/opennox/v1.nox_xxx_unitUpdateMonster_50A5C0(0x40b1c840)
        /github/workspace/src/unit_ai.go:719 +0x59b fp=0x19c4da58 sp=0x19c4d9ec pc=0x1956bab
github.com/noxworld-dev/opennox/v1/legacy.nox_xxx_unitUpdateMonster_50A5C0(...)
        /github/workspace/src/legacy/unit_ai.go:132
_cgoexp_59949970baf3_nox_xxx_unitUpdateMonster_50A5C0(0xdffccc)
        _cgo_gotypes.go:22670 +0x28 fp=0x19c4da60 sp=0x19c4da58 pc=0x139de38
runtime.cgocallbackg1(0x139de10, 0xdffccc, 0x0)
        /go/src/runtime/cgocall.go:315 +0x218 fp=0x19c4dab8 sp=0x19c4da60 pc=0xe24ce8
runtime.cgocallbackg(0x139de10, 0xdffccc, 0x0)
        /go/src/runtime/cgocall.go:234 +0xf5 fp=0x19c4daf0 sp=0x19c4dab8 pc=0xe24a65
runtime.cgocallback(0xe24913, 0x1acf3a0, 0x19c4db30)
        /go/src/runtime/asm_386.s:762 +0x8a fp=0x19c4db00 sp=0x19c4daf0 pc=0xe93b4a
runtime.systemstack_switch()
        /go/src/runtime/asm_386.s:337 fp=0x19c4db04 sp=0x19c4db00 pc=0xe92870
runtime.cgocall(0x1acf3a0, 0x19c4db30)
        /go/src/runtime/cgocall.go:167 +0x83 fp=0x19c4db1c sp=0x19c4db04 pc=0xe24913
github.com/noxworld-dev/opennox/v1/legacy/common/ccall._Cfunc_go_call_void_ptr_func(0x198f580, 0x40b1c840)
        _cgo_gotypes.go:1159 +0x2f fp=0x19c4db30 sp=0x19c4db1c pc=0x124d67f
github.com/noxworld-dev/opennox/v1/legacy/common/ccall.CallVoidPtr.func1(0x198f580, 0x40b1c840)
        /github/workspace/src/legacy/common/ccall/ccall.go:118 +0x4f fp=0x19c4db44 sp=0x19c4db30 pc=0x124d86f
github.com/noxworld-dev/opennox/v1/legacy/common/ccall.CallVoidPtr(0x198f580, 0x40b1c840)
        /github/workspace/src/legacy/common/ccall/ccall.go:118 +0x29 fp=0x19c4db50 sp=0x19c4db44 pc=0x124d809
github.com/noxworld-dev/opennox/v1/server.(*Object).CallUpdate(...)
        /github/workspace/src/server/object.go:1117
github.com/noxworld-dev/opennox/v1.(*Object).CallUpdate(0x40b1c840)
        /github/workspace/src/object.go:876 +0x59 fp=0x19c4db5c sp=0x19c4db50 pc=0x1903489
github.com/noxworld-dev/opennox/v1.(*Server).updateUnitsBBB(0xf8c8900)
        /github/workspace/src/server_update.go:34 +0xd8 fp=0x19c4db84 sp=0x19c4db5c pc=0x1943088
github.com/noxworld-dev/opennox/v1.(*Server).updateUnits(0xf8c8900)
        /github/workspace/src/server.go:130 +0x2d fp=0x19c4db8c sp=0x19c4db84 pc=0x1937fbd
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server_B(0xf8c8900, 0xe0e7)
        /github/workspace/src/server.go:346 +0xa8 fp=0x19c4dbcc sp=0x19c4db8c pc=0x1938f18
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server(0xf8c8900)
        /github/workspace/src/game.go:734 +0x1b2 fp=0x19c4dbfc sp=0x19c4dbcc pc=0x18c0622
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server-fm()
        <autogenerated>:1 +0x27 fp=0x19c4dc08 sp=0x19c4dbfc pc=0x1981b27
github.com/noxworld-dev/opennox/v1/server.(*Server).Update(...)
        /github/workspace/src/server/server.go:151
github.com/noxworld-dev/opennox/v1.(*Server).Update(0xf8c8900)
        /github/workspace/src/server.go:119 +0x5f fp=0x19c4dc2c sp=0x19c4dc08 pc=0x1937edf
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x1)
        /github/workspace/src/gameloop.go:158 +0x3eb fp=0x19c4dcac sp=0x19c4dc2c pc=0x18c7a4b
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x0)
        /github/workspace/src/gameloop.go:186 +0x562 fp=0x19c4dd2c sp=0x19c4dcac pc=0x18c7bc2
github.com/noxworld-dev/opennox/v1.cmainLoop()
        /github/workspace/src/gameloop.go:353 +0x148 fp=0x19c4dd58 sp=0x19c4dd2c pc=0x18c8718
github.com/noxworld-dev/opennox/v1.RunArgs({0xf80a140, 0x1, 0x1})
        /github/workspace/src/main.go:452 +0x290a fp=0x19c4df88 sp=0x19c4dd58 pc=0x18ed17a
main.main()
        cmd/opennox/main.go:12 +0x3b fp=0x19c4dfc4 sp=0x19c4df88 pc=0x198212b
runtime.main()
        /go/src/runtime/proc.go:250 +0x22e fp=0x19c4dff0 sp=0x19c4dfc4 pc=0xe6206e
runtime.goexit()
        /go/src/runtime/asm_386.s:1326 +0x1 fp=0x19c4dff4 sp=0x19c4dff0 pc=0xe93d61
dennwc commented 1 year ago

ryan1.zip

Confirmed, can reproduce with this map.

dennwc commented 1 year ago

Another crash on a different map:

Exception 0xc0000005 0x0 0xacacaeac 0x1a1c408
PC=0x1a1c408
signal arrived during external code execution

runtime.cgocall(0x1996170, 0x101e5b34)
        /go/src/runtime/cgocall.go:157 +0x58 fp=0x101e5b20 sp=0x101e5b08 pc=0xe248e8
github.com/noxworld-dev/opennox/v1/legacy._Cfunc_nox_xxx_unitClearOwner_4EC300(0x40b02c00)
        _cgo_gotypes.go:10470 +0x2f fp=0x101e5b34 sp=0x101e5b20 pc=0x1356c5f
github.com/noxworld-dev/opennox/v1/legacy.Nox_xxx_unitClearOwner_4EC300.func1(0x40b02c00)
        /github/workspace/src/legacy/object.go:374 +0x47 fp=0x101e5b48 sp=0x101e5b34 pc=0x1375577
github.com/noxworld-dev/opennox/v1/legacy.Nox_xxx_unitClearOwner_4EC300(0x40b02c00)
        /github/workspace/src/legacy/object.go:374 +0x21 fp=0x101e5b50 sp=0x101e5b48 pc=0x1375521
github.com/noxworld-dev/opennox/v1.(*Object).SetOwner(0x40b02c00, {0x0, 0x0})
        /github/workspace/src/object.go:739 +0x73 fp=0x101e5b64 sp=0x101e5b50 pc=0x1902eb3
github.com/noxworld-dev/opennox/v1.(*Server).objectDeleteFinish(0xfed6000, 0x40b02c00)
        /github/workspace/src/object.go:127 +0x41 fp=0x101e5b74 sp=0x101e5b64 pc=0x19007b1
github.com/noxworld-dev/opennox/v1.(*Server).deletedObjectsUpdate(0xfed6000)
        /github/workspace/src/object.go:168 +0x17d fp=0x101e5b8c sp=0x101e5b74 pc=0x1900abd
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server_B(0xfed6000, 0x88261)
        /github/workspace/src/server.go:357 +0x2cb fp=0x101e5bcc sp=0x101e5b8c pc=0x193913b
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server(0xfed6000)
        /github/workspace/src/game.go:734 +0x1b2 fp=0x101e5bfc sp=0x101e5bcc pc=0x18c0622
github.com/noxworld-dev/opennox/v1.(*Server).nox_xxx_gameTick_4D2580_server-fm()
        <autogenerated>:1 +0x27 fp=0x101e5c08 sp=0x101e5bfc pc=0x1981b27
github.com/noxworld-dev/opennox/v1/server.(*Server).Update(...)
        /github/workspace/src/server/server.go:151
github.com/noxworld-dev/opennox/v1.(*Server).Update(0xfed6000)
        /github/workspace/src/server.go:119 +0x5f fp=0x101e5c2c sp=0x101e5c08 pc=0x1937edf
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x1)
        /github/workspace/src/gameloop.go:158 +0x3eb fp=0x101e5cac sp=0x101e5c2c pc=0x18c7a4b
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x0)
        /github/workspace/src/gameloop.go:186 +0x562 fp=0x101e5d2c sp=0x101e5cac pc=0x18c7bc2
github.com/noxworld-dev/opennox/v1.cmainLoop()
        /github/workspace/src/gameloop.go:353 +0x148 fp=0x101e5d58 sp=0x101e5d2c pc=0x18c8718
github.com/noxworld-dev/opennox/v1.RunArgs({0xf80a140, 0x1, 0x1})
        /github/workspace/src/main.go:452 +0x290a fp=0x101e5f88 sp=0x101e5d58 pc=0x18ed17a
main.main()
        cmd/opennox/main.go:12 +0x3b fp=0x101e5fc4 sp=0x101e5f88 pc=0x198212b
runtime.main()
        /go/src/runtime/proc.go:250 +0x22e fp=0x101e5ff0 sp=0x101e5fc4 pc=0xe6206e
runtime.goexit()
        /go/src/runtime/asm_386.s:1326 +0x1 fp=0x101e5ff4 sp=0x101e5ff0 pc=0xe93d61
dennwc commented 1 year ago

So in both cases the fault touches address 0xacacaEac which is very close to 0xacacaCac, used by the engine to indicate a deallocated object. So something is touching a dead object.

I was able to reproduce the first crash exactly once, but then it started failing only on the map scripts (legitimately). Then I fixed all engine crashes related to scripts, made it post console errors instead. And now I cannot trigger the (first) crash.

For now I think something happened between the moment the script sent a panic and the actual exit of the engine. Probably during that time it did touch a dead object and crashed.

Still, I'll need to investigate the second crash. Maybe it's something different.

rgarrett15 commented 1 year ago

removing these two objects stoped my crash on one map

ill test more later

image

rgarrett15 commented 1 year ago

I have resolved other crashes in other maps by simply relocating some waypoints as well