ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.9k stars 288 forks source link

starbound_server SIGSERV on a rk3588 arm64 #1352

Closed benjigill closed 8 months ago

benjigill commented 8 months ago

This SIGSEGV is frequently throwing on start-up of the starbound_server. Note frequently, as periodically it will succeed - with no change in parameters. My current workaround is to loop the startup process until it eventually works, which isn't ideal.

This is running inside this base container: sonroyaalmerol/steamcmd-arm64:root-bookworm-2024-03-03, and I installed the box64-rk3588 specific dependency. The container is running on a host rk3588 device.

If I turn off Dynarec with BOX64_DYNAREC=0 it seems to work, but it's unusably slow without Dynarec. Any ideas?

/usr/local/bin/box64 starbound_server
Debug level is 1
Dynarec log level is 1
Dynarec is on
Dynarec will print missing opcodes
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 PageSize:4096 Running on Cortex-A55 Cortex-A76 with 8 Cores
Params database has 60 entries
Box64 with Dynarec v0.2.7 35d734e6 built on Mar  9 2024 06:48:54
BOX64: Detected 48bits at least of address space
New Bridge brick at 0x10000 (size 0x1000)
BOX64: Prefering Emulated libs
BOX64: Disabling handling of SigSEGV
Counted 39 Env var
BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
Looking for starbound_server
Rename process to "starbound_server"
New Bridge brick at 0x20000 (size 0x1000)
Using native(wrapped) libpthread.so.0
New Bridge brick at 0x30000 (size 0x1000)
Using native(wrapped) libdl.so.2
New Bridge brick at 0x40000 (size 0x1000)
Using native(wrapped) librt.so.1
New Bridge brick at 0x50000 (size 0x1000)
Using native(wrapped) libm.so.6
New Bridge brick at 0x60000 (size 0x1000)
Using native(wrapped) libc.so.6
New Bridge brick at 0x70000 (size 0x1000)
Using native(wrapped) ld-linux-x86-64.so.2
New Bridge brick at 0x80000 (size 0x1000)
Using native(wrapped) libutil.so.1
New Bridge brick at 0x90000 (size 0x1000)
Using native(wrapped) libbsd.so.0
New Bridge brick at 0x61000 (size 0x1000)
BOX64 Dynarec: higher max_db=49
BOX64 Dynarec: higher max_db=52
BOX64 Dynarec: higher max_db=58
BOX64 Dynarec: higher max_db=180
BOX64 Dynarec: higher max_db=268
BOX64 Dynarec: higher max_db=576
BOX64 Dynarec: higher max_db=596
BOX64 Dynarec: higher max_db=1404
BOX64 Dynarec: higher max_db=1454
BOX64 Dynarec: higher max_db=1870
[Info] Root: Preparing Root...
[Info] Root: Done preparing Root.
[Info] Root: Scanning for asset sources in directory '../assets/'
[Info] Root: Loaded Configuration in 0.0148427 seconds
[Info] Root: Scanning for asset sources in directory '../mods/'
[Warn] Root: Unrecognized file in asset directory 'mods_go_here', skipping
[Info] Root: Detected asset source named 'base' at '../assets/packed.pak'
[Info] Root: Detected unnamed asset source at '../assets/user'
[Info] Loading assets from: '../assets/packed.pak'
[Info] Loading assets from: '../assets/user'
[Info] Assets digest is 531f0b8469832a566d23a0b9870ed717c63291164883670d0ee17086a100d3cd
[Info] Root: Loaded Assets in 3.142 seconds
[Info] Root: Loaded NameGenerator in 3.20466 seconds
[Info] Root: Loaded PlantDatabase in 0.228515 seconds
[Info] Root: Loaded ObjectDatabase in 0.606057 seconds
[Info] Root: Loaded ProjectileDatabase in 0.30857 seconds
[Info] Root: Loaded NpcDatabase in 0.162651 seconds
[Info] Root: Loaded StagehandDatabase in 0.0110858 seconds
[Info] Root: Loaded VehicleDatabase in 0.0126902 seconds
[Info] Root: Loaded PlayerFactory in 0.0384859 seconds
[Info] Root: Loaded MonsterDatabase in 0.265584 seconds
[Info] Root: Loaded VersioningDatabase in 0.0376424 seconds
[Info] Root: Loaded EntityFactory in 0.065875 seconds
[Info] Root: Loaded ParticleDatabase in 0.143735 seconds
[Info] Root: Loaded ImageMetadataDatabase in 0.000182872 seconds
BOX64 Dynarec: higher max_db=1893
BOX64 Dynarec: higher max_db=2359
[Info] Root: Loaded MaterialDatabase in 0.52418 seconds
[Info] Root: Loaded TerrainDatabase in 0.0148412 seconds
[Info] Root: Loaded BiomeDatabase in 0.0890732 seconds
[Info] Root: Loaded LiquidsDatabase in 0.0277426 seconds
[Info] Root: Loaded StatusEffectDatabase in 0.0244605 seconds
[Info] Root: Writing runtime configuration to '../storage/starbound_server.config'
[Info] Root: Loaded DamageDatabase in 0.43529 seconds
[Info] Root: Loaded EffectSourceDatabase in 0.012948 seconds
[Info] Root: Loaded FunctionDatabase in 0.0324112 seconds
[Info] Root: Loaded TreasureDatabase in 0.0472436 seconds
[Info] Root: Loaded DungeonDefinitions in 0.57579 seconds
[Info] Root: Loaded TilesetDatabase in 0.00114273 seconds
[Info] Root: Loaded StatisticsDatabase in 0.00897034 seconds
[Info] Root: Loaded EmoteProcessor in 0.00301491 seconds
[Info] Root: Loaded SpeciesDatabase in 0.0300732 seconds
[Info] Root: Loaded QuestTemplateDatabase in 0.0900814 seconds
[Info] Root: Loaded AiDatabase in 0.0269174 seconds
[Info] Root: Loaded TechDatabase in 0.00829281 seconds
[Info] Root: Loaded CodexDatabase in 0.0168201 seconds
[Info] Root: Loaded BehaviorDatabase in 0.611564 seconds
[Info] Root: Loaded DanceDatabase in 0.0145175 seconds
[Info] Root: Loaded SpawnTypeDatabase in 0.0152157 seconds
[Info] Root: Loaded RadioMessageDatabase in 0.0141418 seconds
[Info] Root: Loaded ItemDatabase in 7.98123 seconds
[Info] Root: Loaded CollectionDatabase in 5.74088 seconds
0311|SIGSEGV @0x7ffffc6804e8 (???(0x7ffffd56d5d0)) (x64pc=0x12cd1a1//home/steam/starbound/linux/starbound_server:"/home/steam/starbound/linux/starbound_server/je_arena_dalloc_large + 0x1bc", rsp=0x7fffe57ffef8, stack=0x7fffe5000000:0x7fffe5800000 own=0x7fffe5000000 fp=0x60200000), for accessing 0x400000004 (code=1/prot=0), db=0x7ffffc75bd50(0x7ffffc6803c0:0x7ffffc6805e8/0x12cd16c:0x12cd1c2//home/steam/starbound/linux/starbound_server/je_arena_dalloc_large + 0x1bc:clean, hash:cf03bb05/cf03bb05) handler=(nil)
RAX:0x0000000400000004 RCX:0x0000000000000003 RDX:0x0000000060002210 RBX:0x0000000060002200 
RSP:0x00007fffe57ffef8 RBP:0x0000000000000000 RSI:0x0000000000000000 RDI:0x0000000060002210 
 R8:0x00000000000004e0  R9:0x0000000060002330 R10:0x0000000000000008 R11:0x0000000000008000 
R12:0x0000000400000004 R13:0x00007ffff001a428 R14:0x0000000060002210 R15:0x00000000602028d8 
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053 
RSP-0x20:0x00007ffff001a428 RSP-0x18:0x0000000060002210 RSP-0x10:0x00000000602028d8 RSP-0x08:0x00000000012cd174
RSP+0x00:0x0000000000008000 RSP+0x08:0x0000000000000008 RSP+0x10:0x0000000060010480 RSP+0x18:0x00000000600123a0
Segmentation fault (core dumped)
ptitSeb commented 8 months ago

Try the latest box64 version. I have pushed a change to limit temporary memory allocation in the dynarec, that might help starbound (game or server) iirc.

benjigill commented 8 months ago

I installed the latest box64 version, I'm getting the same behavior it seems. Is there any other debug information I can provide that would be useful?

# /usr/local/bin/box64 starbound_server
Debug level is 1
Dynarec log level is 1
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 PageSize:4096 Running on Cortex-A55 Cortex-A76 with 8 Cores
Params database has 60 entries
Box64 with Dynarec v0.2.7 33846405 built on Mar 10 2024 06:45:32
BOX64: Detected 48bits at least of address space
New Bridge brick at 0x10000 (size 0x1000)
BOX64: Disabling handling of SigSEGV
Counted 39 Env var
BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/usr/local/sbin/:/usr/local/bin/:/usr/sbin/:/usr/bin/:/sbin/:/bin/
Looking for starbound_server
Rename process to "starbound_server"
New Bridge brick at 0x20000 (size 0x1000)
Using native(wrapped) libpthread.so.0
New Bridge brick at 0x30000 (size 0x1000)
Using native(wrapped) libdl.so.2
New Bridge brick at 0x40000 (size 0x1000)
Using native(wrapped) librt.so.1
New Bridge brick at 0x50000 (size 0x1000)
Using native(wrapped) libm.so.6
New Bridge brick at 0x60000 (size 0x1000)
Using native(wrapped) libc.so.6
New Bridge brick at 0x70000 (size 0x1000)
Using native(wrapped) ld-linux-x86-64.so.2
New Bridge brick at 0x80000 (size 0x1000)
Using native(wrapped) libutil.so.1
New Bridge brick at 0x90000 (size 0x1000)
Using native(wrapped) libbsd.so.0
New Bridge brick at 0x61000 (size 0x1000)
BOX64 Dynarec: higher max_db=49
BOX64 Dynarec: higher max_db=52
BOX64 Dynarec: higher max_db=58
BOX64 Dynarec: higher max_db=180
BOX64 Dynarec: higher max_db=268
BOX64 Dynarec: higher max_db=576
BOX64 Dynarec: higher max_db=596
BOX64 Dynarec: higher max_db=1404
BOX64 Dynarec: higher max_db=1454
BOX64 Dynarec: higher max_db=1870
[Info] Root: Preparing Root...
[Info] Root: Done preparing Root.
[Info] Root: Scanning for asset sources in directory '../assets/'
[Info] Root: Loaded Configuration in 0.0140782 seconds
[Info] Root: Scanning for asset sources in directory '../mods/'
[Warn] Root: Unrecognized file in asset directory 'mods_go_here', skipping
[Info] Root: Detected asset source named 'base' at '../assets/packed.pak'
[Info] Root: Detected unnamed asset source at '../assets/user'
[Info] Loading assets from: '../assets/packed.pak'
[Info] Loading assets from: '../assets/user'
[Info] Assets digest is 531f0b8469832a566d23a0b9870ed717c63291164883670d0ee17086a100d3cd
[Info] Root: Loaded Assets in 3.32969 seconds
[Info] Root: Loaded NameGenerator in 3.3388 seconds
[Info] Root: Loaded PlantDatabase in 0.167422 seconds
[Info] Root: Loaded ProjectileDatabase in 0.298355 seconds
[Info] Root: Loaded ObjectDatabase in 0.55756 seconds
[Info] Root: Loaded NpcDatabase in 0.135216 seconds
[Info] Root: Loaded StagehandDatabase in 0.0114267 seconds
[Info] Root: Loaded VehicleDatabase in 0.0120818 seconds
[Info] Root: Loaded PlayerFactory in 0.0187565 seconds
[Info] Root: Loaded MonsterDatabase in 0.259653 seconds
[Info] Root: Loaded VersioningDatabase in 0.0306411 seconds
[Info] Root: Loaded EntityFactory in 0.0537133 seconds
[Info] Root: Loaded ParticleDatabase in 0.0868696 seconds
[Info] Root: Loaded ImageMetadataDatabase in 0.00016683 seconds
BOX64 Dynarec: higher max_db=1893
BOX64 Dynarec: higher max_db=2359
[Info] Root: Loaded MaterialDatabase in 0.37101 seconds
[Info] Root: Loaded TerrainDatabase in 0.0125974 seconds
[Info] Root: Loaded BiomeDatabase in 0.0482528 seconds
[Info] Root: Loaded LiquidsDatabase in 0.00923138 seconds
[Info] Root: Loaded StatusEffectDatabase in 0.0175612 seconds
[Info] Root: Loaded DamageDatabase in 0.381077 seconds
[Info] Root: Loaded EffectSourceDatabase in 0.0138294 seconds
[Info] Root: Writing runtime configuration to '../storage/starbound_server.config'
[Info] Root: Loaded FunctionDatabase in 0.0768003 seconds
[Info] Root: Loaded TreasureDatabase in 0.0504551 seconds
[Info] Root: Loaded DungeonDefinitions in 0.439265 seconds
[Info] Root: Loaded TilesetDatabase in 0.00123839 seconds
[Info] Root: Loaded StatisticsDatabase in 0.00570782 seconds
[Info] Root: Loaded EmoteProcessor in 0.00249487 seconds
[Info] Root: Loaded SpeciesDatabase in 0.0255994 seconds
[Info] Root: Loaded QuestTemplateDatabase in 0.0231086 seconds
[Info] Root: Loaded AiDatabase in 0.0151731 seconds
[Info] Root: Loaded TechDatabase in 0.00816069 seconds
[Info] Root: Loaded CodexDatabase in 0.00953558 seconds
[Info] Root: Loaded BehaviorDatabase in 0.53803 seconds
[Info] Root: Loaded DanceDatabase in 0.0113868 seconds
[Info] Root: Loaded SpawnTypeDatabase in 0.013667 seconds
[Info] Root: Loaded RadioMessageDatabase in 0.0126435 seconds
[Info] Root: Loaded ItemDatabase in 6.8087 seconds
[Info] Root: Loaded CollectionDatabase in 5.00818 seconds
1326|SIGSEGV @0xffff77c3e9e8 (???(0xffff86bf4470)) (x64pc=0x12be17a//home/steam/starbound/linux/starbound_server:"/home/steam/starbound/linux/starbound_server/je_iarena_cleanup", rsp=0xffff7732ffd8, stack=0xffff76b30000:0xffff77330000 own=0xffff76b30000 fp=0x60200000), for accessing 0xffffffffffffffff (code=1/prot=0), db=0xffff8c283358(0xffff77c3e9c0:0xffff77c3eb08/0x12be170:0x12be1b7//home/steam/starbound/linux/starbound_server/je_iarena_cleanup:clean, hash:625867f5/625867f5) handler=(nil)
RAX:0x0000000000000000 RCX:0x0000000000000003 RDX:0xffffffffffffffff RBX:0x0000ffff8001a428 
RSP:0x0000ffff7732ffd8 RBP:0x0000ffff7732fff8 RSI:0x0000000000000000 RDI:0x0000ffff8001a428 
 R8:0x0000000000000020  R9:0x0000ffff8001a428 R10:0x0000000000000008 R11:0x0000000000008000 
R12:0x0000000000000000 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000 
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053 
RSP-0x20:0x0000000000000000 RSP-0x18:0x0000000000000000 RSP-0x10:0x0000000000000000 RSP-0x08:0x00000000012ebe72
RSP+0x00:0x0000ffff8001a428 RSP+0x08:0x00000000012ec555 RSP+0x10:0x0000000000000000 RSP+0x18:0x0000000000010080
Segmentation fault (core dumped)
benjigill commented 8 months ago

@ptitSeb This is working now, I see there were a recent number of changes to support opcodes and other changes for ARM64_DYNAREC. I updated to the latest build as of today and it's working without issues.

Thank you!!