Author Topic: LAN game crashes  (Read 6594 times)

bzt

  • Daemon
  • Posts: 7
    • View Profile
LAN game crashes
« on: 2 April 2024, 07:29:09 »
Hi,

Running MegaGlest on Linux. This used to work, but since I've upgraded to 3.13 it doesn't any more.

megaglest v3.13.0
Compiled using: GNUC: 120100 [64bit] platform: Linux-X64 endianness: little
GIT: [Rev: $5604.3a5d459$] - using STREFLOP [SSE] - [no-denormals]

Same OS, same version on both machines. When I choose New Game -> LAN Game -> Host Game on one of the machines, and New Game -> LAN Game -> Find LAN Game on the other.

The game loads and starts, the scene appears with the units, but I can't move the mouse. The server side then quits, the client freezes. I got the following messages on the standard error:

Server side (one that is hosting the game):
[E] pw.loop [loop.c:67 pw_loop_new()] 0x5dbf55938020: can't make support.system handle: No such file or directory
[ALSOFT] (EE) Failed to create PipeWire event thread loop (errno: 2)
[ALSOFT] (EE) Could not query RTKit: No such file or directory (2)
/usr/include/c++/12.1.0/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Glest::Game::NetworkCommand; _Alloc = std::allocator<Glest::Game::NetworkCommand>; reference = Glest::Game::NetworkCommand&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
(and it quits)

Client side (one that connects):
[E] pw.loop [loop.c:67 pw_loop_new()] 0x62d498b5fc20: can't make support.system handle: No such file or directory
[ALSOFT] (EE) Failed to create PipeWire event thread loop (errno: 2)
/usr/include/c++/12.1.0/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = Glest::Game::NetworkCommand; _Alloc = std::allocator<Glest::Game::NetworkCommand>; reference = Glest::Game::NetworkCommand&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)
(and it freezes, does not respond to anything, and I must kill it with sigkill)

Any idea how to fix this?

Thanks!
bzt

jammyjamjamman

  • Administrator
  • Horseman
  • ********
  • Posts: 210
    • View Profile
Re: LAN game crashes
« Reply #1 on: 6 April 2024, 20:12:28 »
Hi bzt,

Thanks for your report. What exact OS are you trying to run the game on?
Also, have you opened the TCP port 61357 (or 61357-61366 or whatever port you're hosting on) in your firewall in your OS? (If your firewall is not active, you don't need to worry about this step.)

If you're up for experimentation, you could try compiling and using the latest MG development version and checking whether the game crashes there:
https://docs.megaglest.org/index.php?title=MG/Getting_The_Code#Linux_quick_setup
"All right, I've been thinking. When life gives you lemons? Don't make lemonade. Make life take the lemons back! Get mad! 'I don't want your damn lemons! What am I supposed to do with these?'" ~Cave Johnson, Portal 2

bzt

  • Daemon
  • Posts: 7
    • View Profile
Re: LAN game crashes
« Reply #2 on: 10 April 2024, 11:27:56 »
Thank you for your answer!
What exact OS are you trying to run the game on?
x86_64 GNU/Linux, kernel 6.8.2-1
Also, have you opened the TCP port 61357 (or 61357-61366 or whatever port you're hosting on) in your firewall in your OS?
Both machines are in the same LAN, there's no firewall between them (firewall is only installed on the router on the WAN interface). But to be sure, I've checked, with a dummy listener and netcat, I can communicate on those ports.
If you're up for experimentation, you could try compiling and using the latest MG development version and checking whether the game crashes there:
Thanks, I'll try and report back.

FYI, I was wondering, I'm using MegaGlest in a row for years now, always upgrading it with my distro. Could it be that some very old incompatible config file remained and that's causing this? (I've tried to remove the package and reinstall, but that does not necessarily clear all the user specific config, just the system-wide config. I've manually deleted the entire ~/.megaglest directory, and I was looking for files under ~/.config and ~/.cache but couldn't find any.) I've also tried to run through strace to locate the configs, but there's way too much noise.

Thanks,
bzt

EDIT: Ok, I've compiled the game from the latest git repo. Compilation gave some warnings:
Code: [Select]
In file included from /home/bzt/Documents/megaglest-source/source/shared_lib/include/util/utf8.h:31,
                 from /home/bzt/Documents/megaglest-source/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp:21:
/home/bzt/Documents/megaglest-source/source/shared_lib/include/util/utf8/checked.h:268:34: warning: 'template<class _Category, class _Tp, class _Distance, class _Pointer, class _Reference> struct std::iterator' is deprecated [-Wdeprecated-declarations]
  268 |     class iterator : public std::iterator <std::bidirectional_iterator_tag, uint32_t> {
      |                                  ^~~~~~~~
In file included from /usr/include/c++/13.2.1/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/13.2.1/string:47,
                 from /home/bzt/Documents/megaglest-source/source/shared_lib/include/graphics/text_renderer.h:15,
                 from /home/bzt/Documents/megaglest-source/source/shared_lib/include/graphics/gl/text_renderer_gl.h:15,
                 from /home/bzt/Documents/megaglest-source/source/shared_lib/sources/graphics/gl/text_renderer_gl.cpp:12:
/usr/include/c++/13.2.1/bits/stl_iterator_base_types.h:127:34: note: declared here
  127 |     struct _GLIBCXX17_DEPRECATED iterator
      |                                  ^~~~~~~~
This is repeated on several places.
Code: [Select]
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/common/base_thread.cpp: In destructor 'virtual Shared::PlatformCommon::BaseThread::~BaseThread()':
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/common/base_thread.cpp:95:17: warning: 'throw' will always call 'terminate' [-Wterminate]
   95 |                 throw megaglest_runtime_error(szBuf);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/common/base_thread.cpp:95:17: note: in C++11 destructors default to 'noexcept'
Again, same error repeated on several places.
Code: [Select]
In file included from /home/bzt/Documents/megaglest-source/source/shared_lib/include/util/util.h:20,
                 from /home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/miniftpclient.cpp:14:
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/miniftpclient.cpp: In member function 'std::pair<Shared::PlatformCommon::FTP_Client_ResultType, std::__cxx11::basic_string<char> > Shared::PlatformCommon::FTPClientThread::getFileFromServer(Shared::PlatformCommon::FTP_Client_CallbackType, std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >, std::string, std::string, std::string, std::string, std::vector<std::__cxx11::basic_string<char> >*)':
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/miniftpclient.cpp:1005:32: warning: 'CURLOPT_PROGRESSFUNCTION' is deprecated: since 7.32.0. Use CURLOPT_XFERINFOFUNCTION [-Wdeprecated-declarations]
 1005 |         curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, file_progress);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/curl/curl.h:1291:3: note: declared here
 1291 |   CURLOPTDEPRECATED(CURLOPT_PROGRESSFUNCTION, CURLOPTTYPE_FUNCTIONPOINT, 56,
      |   ^~~~~~~~~~~~~~~~~
Not sure if this is relevant for this bug.
Code: [Select]
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/ircclient.cpp: In function 'void Shared::PlatformCommon::dump_event(irc_session_t*, const char*, const char*, const char**, unsigned int)':
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/ircclient.cpp:81:25: warning: 'char* strncat(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Wstringop-overflow=]
   81 |                 strncat (buf, params[cnt],std::min((int)strlen(params[cnt]),511));
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bzt/Documents/megaglest-source/source/shared_lib/sources/platform/posix/ircclient.cpp:81:63: note: length computed here
   81 |                 strncat (buf, params[cnt],std::min((int)strlen(params[cnt]),511));
      |                                                         ~~~~~~^~~~~~~~~~~~~
This is obviously a bug in the compiler (std::min makes sure of it that there's no buffer overflow here).

The compiled editor crashes with the following message:
Code: [Select]
$ ./megaglest_editor
Using wxWidgets version [3.2.4.0]

(megaglest_editor:291916): Gtk-CRITICAL **: 13:48:13.744: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.745: Negative content width -5 (allocation 2, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.745: Negative content height -6 (allocation 1, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.746: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkToggleButton)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.782: Negative content width -5 (allocation 2, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.782: Negative content height -6 (allocation 1, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.782: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkToggleButton)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.783: Negative content height -6 (allocation 1, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(megaglest_editor:291916): Gtk-WARNING **: 13:48:13.783: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkToggleButton)
*** BUG ***
In pixman_region32_init_rect: Invalid rectangle passed
Set a breakpoint on '_pixman_log_error' to debug

Segmentation fault (core dumped)

But the LAN game seems to work:
Code: [Select]
$ ./megaglest
megaglest v3.13-dev
Compiled using: GNUC: 130201 [64bit] platform: Linux-X64 endianness: little
GIT: [Rev: 5888.d32221a] - using STREFLOP [SSE] - [no-denormals]
Auto Change resolution to (1920 x 1080) from (800 x 600)
MainWindow forced change of resolution to desktop values (1920 x 1080) instead of (800 x 600)
[E] pw.loop [loop.c:67 pw_loop_new()] 0x61d1e0ff3330: can't make support.system handle: No such file or directory
[ALSOFT] (EE) Failed to create PipeWire event thread loop (errno: 2)
Game unique identifier is: d33a651e-f731-11ee-a4a2-af255dcbaa08

**STEAM NOT detected, writing out NON STEAM end game stats for player!
It worth noting that this 3.13-dev does not recognize the installed mods (empty list), but with the defaults it starts and I'm able to move units, no crash.

EDIT2: one more thing, I have this in glest.ini:
Code: [Select]
...
LogPath=$HOME/.megaglest/
DayTime=1000
DebugLogFile=debug.log
DebugMode=true
DebugPerformance=false
DebugNetwork=true
DebugWorldSynch=true
...
But ~/.megaglest/debug.log is not created.

Hope this helps,
bzt
« Last Edit: 10 April 2024, 12:31:11 by bzt »

jammyjamjamman

  • Administrator
  • Horseman
  • ********
  • Posts: 210
    • View Profile
Re: LAN game crashes
« Reply #3 on: 18 April 2024, 17:13:40 »
Thanks for testing the dev version.

Quote
FYI, I was wondering, I'm using MegaGlest in a row for years now, always upgrading it with my distro. Could it be that some very old incompatible config file remained and that's causing this?
If you've deleted the .megaglest/ folder, that will have removed all the configs I think. It's not XDG compliant, so this is the only place you need to look.

A lot of the warnings are just due to the fact that mg codebase is very old and doesn't comply with more modern c++. Some of the errors suggest they're c++17 standards:
Code: [Select]
_GLIBCXX17_DEPRECATED iterator
I don't know why this happens, since there's sevaral places in cmake with this flag:
Code: [Select]
"-std=c++11"
Code: [Select]
(megaglest_editor:291916): Gtk-CRITICAL **: 13:48:13.744: gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failedI think this error is very hard to diagnose. I think it means there's not enough space to render all components.
"All right, I've been thinking. When life gives you lemons? Don't make lemonade. Make life take the lemons back! Get mad! 'I don't want your damn lemons! What am I supposed to do with these?'" ~Cave Johnson, Portal 2