Skip to content

Conversation

@ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented May 26, 2021

RoRserver crashes a lot. In effort to make gdb backtraces more informative, I partitioned the code to smaller functions. I also checked printf() format strings.

see https://forum.rigsofrods.org/threads/rorserver-woes.3225/

@tritonas00 If you get really bored, I found a tutorial (actually 2 explaining the same mechanism) how to pinpoint the exact crash site with gdb breakpoints:

@ohlidalp ohlidalp force-pushed the crashes branch 2 times, most recently from 77c3e75 to eaf2e06 Compare May 30, 2021 21:35
@tritonas00
Copy link
Collaborator

tritonas00 commented May 31, 2021

Got many AS warnings (i build with cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DRORSERVER_WITH_ANGELSCRIPT:BOOL=ON .)

/home/babis/Downloads/ror-server/dependencies/angelscript/include/angelscript.h:620:11: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  620 |           if( hasCopyConstructor )

one warning

/home/babis/Downloads/ror-server/source/server/userauth.cpp: In member function ‘int UserAuth::readConfig(const char*)’:
/home/babis/Downloads/ror-server/source/server/userauth.cpp:98:20: warning: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 40 bytes from a string of length 2047 [-Wstringop-truncation]
   98 |             strncpy(user_nick, c, NICK_LEN);

and one error

/home/babis/Downloads/ror-server/source/server/sequencer.cpp: In member function ‘broadcastType Sequencer::ProcessUtf8Chat(Client*, int, unsigned int, char*, unsigned int)’:
/home/babis/Downloads/ror-server/source/server/sequencer.cpp:1148:56: error: invalid conversion from ‘int’ to ‘broadcastType’ [-fpermissive]
 1148 |         if (scriptpub != BROADCAST_AUTO) publishMode = scriptpub;
      |                                                        ^~~~~~~~~
      |                                                        |
      |                                                        int

ohlidalp added 4 commits June 8, 2021 23:49
'pthread' was replaced by STL as threading/mutex provider.
Socket setup - bind() and listen() is now done on main thread instead of complicated async setup with "ready" condition.
Shutdown is now done by synchronously closing the listen-socket's file descriptor.

The code which validates RoRnet connection was left mostly intact, just with some added error reporting.
pthread (with custom wrappers) replaced with STL thread.

removed nonsense atomic `m_keep_running`, using single mutex with state enum.
Classic printf() vs. std::string.
Removed variable `SWBaseSocket::error_string` which was written and read on any error, without synchronization. This is a problem in Rigs of Rods server which uses each client socket from 2 threads: receiver and broadcaster.

Function `SWBaseSocket::set_error()` was modified to only fill the supplied SWBaseError object, without touching anything in the SWBaseSocket object. Also, the function won't shut down the whole program with `exit()` anymore.

"verbose mode" was removed completely.
@ohlidalp
Copy link
Member Author

Obsoleted by #143

@ohlidalp ohlidalp closed this Apr 29, 2022
@ohlidalp ohlidalp deleted the crashes branch September 1, 2025 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants