H-uru / dirtsand

The D'ni in Real-Time Server and Network Dæmon
GNU Affero General Public License v3.0
35 stars 24 forks source link

Starting Game Server results in segfault #122

Closed mclayan closed 5 years ago

mclayan commented 6 years ago

I set up a new instance of dirtsand from scratch on a freshly installed Ubuntu server 17.04. Logging in and configuring my avatar works (mostly) fine but linking the first time to Personal will crash the whole server (as well as my bash). It happens every time I select my player after logging in with my account. This is the crash message of dirtsand:

ds-918> [Status] Running on 0.0.0.0/8080
[Lobby] Running on 0.0.0.0/14617
[Auth] Login U:admin P:{ password hash } T: O:win
[Auth] 192.168.0.41/50224 logged in as admin {17e4dd60-4b4e-4104-be20-a97d12c89a05}
[Auth] {17e4dd60-4b4e-4104-be20-a97d12c89a05} signed in as Admin (10104)
[Auth] 192.168.0.41/50224 Requesting game server {b4cf331d-b586-499d-b33e-20feeafad256} Personal
Segfault at bin/dirtsand(+0x11b590) [0x563c86865590]
    from bin/dirtsand(+0x11b6c6) [0x563c868656c6]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7f67a2ee3140]
    from bin/dirtsand(_ZN3SDL5State5mergeERKS0_+0x28) [0x563c8688027c]
    from bin/dirtsand(_Z15start_game_hostj+0x7ee) [0x563c86853921]
    from bin/dirtsand(_Z14find_game_hostj+0xa9) [0x563c86846e7d]
    from bin/dirtsand(_Z7cb_joinR18GameClient_Private+0xbc) [0x563c86847028]
    from bin/dirtsand(_Z11cb_sockReadR18GameClient_Private+0x81) [0x563c86847841]
    from bin/dirtsand(_Z13wk_gameWorkerPv+0x171) [0x563c86847c31]
    from bin/dirtsand(_ZSt13__invoke_implIvPFvPvEJS0_EET_St14__invoke_otherOT0_DpOT1_+0x34) [0x563c86813a53]
    from bin/dirtsand(_ZSt8__invokeIPFvPvEJS0_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS4_DpOS5_+0x4e) [0x563c86813071]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x563c868142bb]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEEclEv+0x2c) [0x563c8681425c]
    from bin/dirtsand(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPvES3_EEEEE6_M_runEv+0x1c) [0x563c8681422c]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbc0ff) [0x7f67a377e0ff]
    from /lib/x86_64-linux-gnu/libpthread.so.0(+0x77fc) [0x7f67a32937fc]
    from /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f67a2fc0b5f]
Unhandled exception at bin/dirtsand(+0x11b590) [0x563c86865590]
    from bin/dirtsand(+0x11b6e0) [0x563c868656e0]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6d0) [0x563c868656d0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7f67a2ee3140]
    from bin/dirtsand(_ZN3SDL5State5mergeERKS0_+0x28) [0x563c8688027c]
    from bin/dirtsand(_Z15start_game_hostj+0x7ee) [0x563c86853921]
    from bin/dirtsand(_Z14find_game_hostj+0xa9) [0x563c86846e7d]
    from bin/dirtsand(_Z7cb_joinR18GameClient_Private+0xbc) [0x563c86847028]
    from bin/dirtsand(_Z11cb_sockReadR18GameClient_Private+0x81) [0x563c86847841]
    from bin/dirtsand(_Z13wk_gameWorkerPv+0x171) [0x563c86847c31]
    from bin/dirtsand(_ZSt13__invoke_implIvPFvPvEJS0_EET_St14__invoke_otherOT0_DpOT1_+0x34) [0x563c86813a53]
    from bin/dirtsand(_ZSt8__invokeIPFvPvEJS0_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS4_DpOS5_+0x4e) [0x563c86813071]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x563c868142bb]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEEclEv+0x2c) [0x563c8681425c]
    from bin/dirtsand(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPvES3_EEEEE6_M_runEv+0x1c) [0x563c8681422c]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbc0ff) [0x7f67a377e0ff]
    from /lib/x86_64-linux-gnu/libpthread.so.0(+0x77fc) [0x7f67a32937fc]
    from /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f67a2fc0b5f]
Unhandled exception at bin/dirtsand(+0x11b590) [0x563c86865590]
    from bin/dirtsand(+0x11b6e0) [0x563c868656e0]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6ea) [0x563c868656ea]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6d0) [0x563c868656d0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7f67a2ee3140]
    from bin/dirtsand(_ZN3SDL5State5mergeERKS0_+0x28) [0x563c8688027c]
    from bin/dirtsand(_Z15start_game_hostj+0x7ee) [0x563c86853921]
    from bin/dirtsand(_Z14find_game_hostj+0xa9) [0x563c86846e7d]
    from bin/dirtsand(_Z7cb_joinR18GameClient_Private+0xbc) [0x563c86847028]
    from bin/dirtsand(_Z11cb_sockReadR18GameClient_Private+0x81) [0x563c86847841]
    from bin/dirtsand(_Z13wk_gameWorkerPv+0x171) [0x563c86847c31]
    from bin/dirtsand(_ZSt13__invoke_implIvPFvPvEJS0_EET_St14__invoke_otherOT0_DpOT1_+0x34) [0x563c86813a53]
    from bin/dirtsand(_ZSt8__invokeIPFvPvEJS0_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS4_DpOS5_+0x4e) [0x563c86813071]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x563c868142bb]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEEclEv+0x2c) [0x563c8681425c]
    from bin/dirtsand(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPvES3_EEEEE6_M_runEv+0x1c) [0x563c8681422c]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbc0ff) [0x7f67a377e0ff]
    from /lib/x86_64-linux-gnu/libpthread.so.0(+0x77fc) [0x7f67a32937fc]
    from /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f67a2fc0b5f]
Unhandled exception at bin/dirtsand(+0x11b590) [0x563c86865590]
    from bin/dirtsand(+0x11b6e0) [0x563c868656e0]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6ea) [0x563c868656ea]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6ea) [0x563c868656ea]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fc86) [0x7f67a3751c86]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8fcd1) [0x7f67a3751cd1]
    from bin/dirtsand(_ZNSt6threadD2Ev+0x21) [0x563c8680d8bf]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bec0) [0x7f67a2ee7ec0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x3bf1a) [0x7f67a2ee7f1a]
    from bin/dirtsand(+0x11b6d0) [0x563c868656d0]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7f67a2ee3140]
    from bin/dirtsand(_ZN3SDL5State5mergeERKS0_+0x28) [0x563c8688027c]
    from bin/dirtsand(_Z15start_game_hostj+0x7ee) [0x563c86853921]
    from bin/dirtsand(_Z14find_game_hostj+0xa9) [0x563c86846e7d]
    from bin/dirtsand(_Z7cb_joinR18GameClient_Private+0xbc) [0x563c86847028]
    from bin/dirtsand(_Z11cb_sockReadR18GameClient_Private+0x81) [0x563c86847841]
    from bin/dirtsand(_Z13wk_gameWorkerPv+0x171) [0x563c86847c31]
    from bin/dirtsand(_ZSt13__invoke_implIvPFvPvEJS0_EET_St14__invoke_otherOT0_DpOT1_+0x34) [0x563c86813a53]
    from bin/dirtsand(_ZSt8__invokeIPFvPvEJS0_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS4_DpOS5_+0x4e) [0x563c86813071]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x563c868142bb]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEEclEv+0x2c) [0x563c8681425c]
    from bin/dirtsand(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPvES3_EEEEE6_M_runEv+0x1c) [0x563c8681422c]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbc0ff) [0x7f67a377e0ff]
    from /lib/x86_64-linux-gnu/libpthread.so.0(+0x77fc) [0x7f67a32937fc]
    from /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f67a2fc0b5f]

My configuration:

DS: built from latest source (tried with an older commit too; same result)
Client: Internal, Debug; built from source; startet with /LocalData and /SkipPreload
OS: Ubuntu server 17.04 x64

From dirtsand.ini:


File.Host = 127.0.0.1
Auth.Host = 192.168.0.29
Game.Host = 192.168.0.29

File.Root = /home/dirtsand/dirtsand-root/file
Auth.Root = /home/dirtsand/dirtsand-root/authdata
Sdl.Path = /home/dirtsand/dirtsand-root/file/SDL
Age.Path = /home/dirtsand/dirtsand-root/file/ages

FS setup All files are unencrypted as I'm using the internal client. Personal.age and Personal.sdl exist in both authdata/ and files

+--dirtsand-root/
|   +--file/
|   |   +--SDL/
|   |   |   +--*.sdl
|   |   +--ages/
|   |   |   +--*.age
|   |   |   +--*.fni
|   +--authdata/
|   |   +--Python/
|   |   |   +--*.py
|   |   +--SDL/
|   |   |   +--*.sdl
|   +--bin/
|   |   +--dirtsand
|   |   +--dsData.sh
|   +--dirtsand.ini
zrax commented 6 years ago

It looks like it's running into an issue merging the Global SDL state for the age with the age's local SDL state (both from the Vault). Is this on a clean vault db? Does the client's SDL match the server's SDL?

mclayan commented 6 years ago

@zrax Yes, client and server share exactly the same .sdl and .age (and .fni) files. I dropped the whole database and re-created it, copied a set of files from a repository to the server and client, replacing existing files. EDIT: here the latest crash log. Seems different this time:


[Auth] 192.168.0.41/50953 logged in as admin {b5455a61-ed4a-49d4-859a-961924bd1b2d}
[Auth] {b5455a61-ed4a-49d4-859a-961924bd1b2d} signed in as Admin (10104)
[SDL] Requested invalid descriptor AvatarCustomization
[Vault] Warning: Could not find SDL descriptor for AvatarCustomization
[Auth] 192.168.0.41/50953 Requesting game server {7dc618e5-7b71-48ad-99c7-54c982f3a445} AvatarCustomization
[SDL] Requested invalid descriptor AvatarCustomization
[Auth] 192.168.0.41/50953 Requesting game server {3fd6f89d-6aa8-4b68-ab38-cdeb067efff9} Personal
Segfault at bin/dirtsand(+0x11b590) [0x55dc41001590]
    from bin/dirtsand(+0x11b6c6) [0x55dc410016c6]
    from /lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7f9b2d753140]
    from bin/dirtsand(_ZN3SDL5State5mergeERKS0_+0x28) [0x55dc4101c27c]
    from bin/dirtsand(_Z15start_game_hostj+0x7ee) [0x55dc40fef921]
    from bin/dirtsand(_Z14find_game_hostj+0xa9) [0x55dc40fe2e7d]
    from bin/dirtsand(_Z7cb_joinR18GameClient_Private+0xbc) [0x55dc40fe3028]
    from bin/dirtsand(_Z11cb_sockReadR18GameClient_Private+0x81) [0x55dc40fe3841]
    from bin/dirtsand(_Z13wk_gameWorkerPv+0x171) [0x55dc40fe3c31]
    from bin/dirtsand(_ZSt13__invoke_implIvPFvPvEJS0_EET_St14__invoke_otherOT0_DpOT1_+0x34) [0x55dc40fafa53]
    from bin/dirtsand(_ZSt8__invokeIPFvPvEJS0_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS4_DpOS5_+0x4e) [0x55dc40faf071]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43) [0x55dc40fb02bb]
    from bin/dirtsand(_ZNSt6thread8_InvokerISt5tupleIJPFvPvES2_EEEclEv+0x2c) [0x55dc40fb025c]
    from bin/dirtsand(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJPFvPvES3_EEEEE6_M_runEv+0x1c) [0x55dc40fb022c]
    from /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbc0ff) [0x7f9b2dfee0ff]
    from /lib/x86_64-linux-gnu/libpthread.so.0(+0x77fc) [0x7f9b2db037fc]
    from /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f) [0x7f9b2d830b5f]
Speicherzugriffsfehler (Speicherabzug geschrieben)   #may be translated to "Segmentation fault (core dumped)"
Hoikas commented 6 years ago

This appears to be an issue with string_theory's case insensitive hash or equals, @zrax. In my testing, when the client requests the Personal SDL, we ask the unordered_map for the Personal SDL. That SDL is present in the map, but the map doesn't return it.

dpogue commented 6 years ago

I'm guessing https://github.com/zrax/string_theory/commit/be30cb25b469773ae7f4a1ef3d6e044518be1d5e might be a step towards fixing this

zrax commented 6 years ago

It's actually highly doubtful, unless you have SDL filenames with non BMP/ASCII characters in them.

brennana commented 5 years ago

Commenting to note that I experience the exact same issue (including call traces stemming from a segfault in SDL::State::merge()) as stated by the OP after compiling and running the latest dirtsand (plus latest string_theory) on a couple different machines (x86 ubuntu server 18.04, and arch linux ARM). Both used fresh databases built independently on each machine with the exact same results upon attempting to link to Relto after successful avatar customization.

Let me know if there's anything you'd like me to try on my end.