Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when network game starts if built with -D_GLIBCXX_ASSERTIONS #309

Open
andy5995 opened this issue Feb 19, 2025 · 2 comments
Open

Crash when network game starts if built with -D_GLIBCXX_ASSERTIONS #309

andy5995 opened this issue Feb 19, 2025 · 2 comments

Comments

@andy5995
Copy link
Collaborator

When a network game starts, after the loading screen, the game freezes for a moment, then crashes.

The console output is similar to

$ megaglest
megaglest v3.13.0
Compiled using: GNUC: 140201 [64bit] platform: Linux-X64 endianness: little
GIT: [Rev: $5604.3a5d459$] - using STREFLOP [SSE] - [no-denormals]
Game unique identifier is: 06e55166-ee27-11ef-affe-fd95e2b16f6a
/usr/include/c++/14.2.1/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator [with _Tp = Glest::Game::NetworkCommand; _Alloc = std::allocatorGlest::Game::NetworkCommand; reference = Glest::Game::NetworkCommand&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

I got this output now when trying megaglest from the Manjaro package (on Manjaro). I cloned the MegaGlest Arch PKGBUILD repo and built with makepkg. I see by default MG is being built with -D_GLIBCXX_ASSERTIONS.

I noticed this when working on the meson PR (#256) and added the b_ndebug=true option:

    'buildtype=debugoptimized',
    'cpp_std=c++11',
    'b_ndebug=true',

which removes -D_GLIBCXX_ASSERTIONS from the build.

MegaGlest should work as expected whether that flag is added or not. This issue needs to be debugged and fixed.

@andy5995
Copy link
Collaborator Author

I opened a separate issue on the Arch repo https://gitlab.archlinux.org/archlinux/packaging/packages/megaglest/-/issues/1

@andy5995 andy5995 changed the title MegaGlest crashes when network game starts if built with -D_GLIBCXX_ASSERTIONS Crash when network game starts if built with -D_GLIBCXX_ASSERTIONS Feb 19, 2025
@andy5995 andy5995 added this to the v3.14.0 milestone Feb 19, 2025
@andy5995
Copy link
Collaborator Author

This the output when a network game starts, when MG is built with '-fsanitize=address,undefined' using gcc

Game unique identifier is: b64b0f5c-f196-11ef-9e9f-d33b9aca3fa6
../../source/glest_game/network/network_message.cpp:1892:45: runtime error: member call on misaligned address 0x7aac2e4b1c3f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4b1c3f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1131:25: runtime error: member access within misaligned address 0x7aac2e4b1c3f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4b1c3f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1131:34: runtime error: reference binding to null pointer of type 'struct value_type'
../../source/glest_game/network/network_message.cpp:1892:8: runtime error: null pointer passed as argument 2, which is declared to never be null
../../source/glest_game/network/network_message.cpp:1659:25: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1285:20: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1285:47: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1294:21: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:590:43: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1908:14: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:999:47: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:999:47: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:999:47: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:306:22: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:306:22: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1908:23: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:993:40: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:993:66: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1911:30: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1911:50: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1912:22: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1912:44: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'const struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:593:15: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:594:15: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:595:46: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:874:39: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:874:39: runtime error: reference binding to misaligned address 0x7aac2e4df43f for type 'struct NetworkCommand *', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_iterator.h:1068:9: runtime error: load of misaligned address 0x7aac2e4df43f for type 'struct NetworkCommand *', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:595:36: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:894:39: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:894:39: runtime error: reference binding to misaligned address 0x7aac2e4df447 for type 'struct NetworkCommand *', which requires 8 byte alignment
0x7aac2e4df447: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00 00 00 00 00 00  70 f4 4d
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:596:44: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:596:44: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:380:34: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:624:37: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:634:33: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:648:44: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:648:44: runtime error: member call on misaligned address 0x7aac2e4df43f for type 'struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:687:33: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:692:30: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:693:31: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 f0  b0 b0 00 30 50 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/vector.tcc:694:39: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct vector', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 f0  b0 b0 00 30 50 00 00 10  b1 b0 00 30 50 00 00 00  00 00 00 00 00 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:389:20: runtime error: member access within misaligned address 0x7aac2e4df43f for type 'struct _Vector_base', which requires 8 byte alignment
0x7aac2e4df43f: note: pointer points here
 00 00 00 00 40  31 a3 02 60 50 00 00 80  31 a3 02 60 50 00 00 80  31 a3 02 60 50 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1288:30: runtime error: member access within misaligned address 0x7aac2e48543f for type 'struct vector', which requires 8 byte alignment
0x7aac2e48543f: note: pointer points here
 00 00 00 00 00  7e ef 05 c0 50 00 00 60  7e ef 05 c0 50 00 00 80  7e ef 05 c0 50 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1288:37: runtime error: member access within misaligned address 0x7aac2e48543f for type 'struct vector', which requires 8 byte alignment
0x7aac2e48543f: note: pointer points here
 00 00 00 00 00  7e ef 05 c0 50 00 00 60  7e ef 05 c0 50 00 00 80  7e ef 05 c0 50 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1290:22: runtime error: member access within misaligned address 0x7aac2e48543f for type 'struct vector', which requires 8 byte alignment
0x7aac2e48543f: note: pointer points here
 00 00 00 00 00  7e ef 05 c0 50 00 00 60  7e ef 05 c0 50 00 00 80  7e ef 05 c0 50 00 00 6e  69 00 00
             ^ 
/usr/include/c++/14.2.1/bits/stl_vector.h:1290:6: runtime error: member access within misaligned address 0x7aac2e48543f for type 'struct vector', which requires 8 byte alignment
0x7aac2e48543f: note: pointer points here
 00 00 00 00 00  7e ef 05 c0 50 00 00 60  7e ef 05 c0 50 00 00 80  7e ef 05 c0 50 00 00 6e  69 00 00
             ^ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant