Closed ghost closed 3 years ago
A stack trace for both of your issues would be nice. You can probably get it with valgrind I guess.
I could not reproduce
I could reproduce on your server, lamp. I could send you the code used to do it if you'd like.
I could reproduce using your code.
I reproduced in local test environment. It only worked after connecting a regular client to the server; nothing happened when there was nothing else connected.
(gdb) run dog
Starting program: /home/me/multiplayerpiano-server/out dog
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Listening on 0.0.0.0:1234
Password is: dog
New client: 127.0.0.1
Created new room: lobby
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
Valgrind output
$ valgrind ./out dog
==11497== Memcheck, a memory error detector
==11497== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==11497== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==11497== Command: ./out dog
==11497==
==11497== error calling PR_SET_PTRACER, vgdb might block
Listening on 0.0.0.0:1234
Password is: dog
New client: 127.0.0.1
Created new room: lobby
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
==11497==
==11497== Process terminating with default action of signal 6 (SIGABRT)
==11497== at 0x4E3E18B: raise (raise.c:51)
==11497== by 0x4E1D858: abort (abort.c:79)
==11497== by 0x4C98950: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==11497== by 0x4CA447B: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==11497== by 0x4CA44E6: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==11497== by 0x4CA4798: __cxa_throw (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==11497== by 0x4C9B3BD: std::__throw_out_of_range(char const*) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==11497== by 0x135AFD: ??? (in /home/me/multiplayerpiano-server/out)
==11497== by 0x131EE9: ??? (in /home/me/multiplayerpiano-server/out)
==11497== by 0x113A64: ??? (in /home/me/multiplayerpiano-server/out)
==11497== by 0x11A2CF: ??? (in /home/me/multiplayerpiano-server/out)
==11497== by 0x139EBC: ??? (in /home/me/multiplayerpiano-server/out)
==11497==
==11497== HEAP SUMMARY:
==11497== in use at exit: 1,022,814 bytes in 3,770 blocks
==11497== total heap usage: 4,979 allocs, 1,209 frees, 1,172,563 bytes allocated
==11497==
==11497== LEAK SUMMARY:
==11497== definitely lost: 0 bytes in 0 blocks
==11497== indirectly lost: 0 bytes in 0 blocks
==11497== possibly lost: 144 bytes in 1 blocks
==11497== still reachable: 1,022,670 bytes in 3,769 blocks
==11497== of which reachable via heuristic:
==11497== stdstring : 38 bytes in 1 blocks
==11497== suppressed: 0 bytes in 0 blocks
==11497== Rerun with --leak-check=full to see details of leaked memory
==11497==
==11497== For lists of detected and suppressed errors, rerun with: -s
==11497== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Aborted (core dumped)
Fixed by f2c91e305533aa7597b6853a0244f837bbefab5c