lsalzman / enet

ENet reliable UDP networking library
MIT License
2.75k stars 670 forks source link

Network jitter crashes ENet when ENET_PACKET_FLAG_UNSEQUENCED used with ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT (stacktraces from valgrind included) #134

Closed fanick1 closed 4 years ago

fanick1 commented 4 years ago

Hi, I think there might be some bug in ENet that causes it to crash when the network conditions are crap.

I'm developing online gameplay for the game duel6 where the packets are being sent unreliably most of the time to transfer for example player's positions. I create the packets with flags ENET_PACKET_FLAG_UNSEQUENCED | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT (on separate channel from the reliable packets if that plays any role). In one test scenario I artifically induce delay and jitter on the server with the command sudo tc qdisc change dev ens3 root netem delay 500ms 150ms 50% - i.e. 500ms additional ping with 150ms variance with the next random element depending 50% on the last one. The amount of data is above the MTU of 1400 bytes, so some fragmentation needs to occur. (I'm doing this test to make sure the game actually works in real life network conditions that we have came across during game testing). In this scenario the game crashes in first seconds after client connects and the server starts pushing game state updates. if I remove the ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT flag, the game does not crash also if I don't induce the jitter the game also does not crash.

I have run the game with the valgrind with the following finding:

==18474== Invalid read of size 8
==18474==    at 0x59FE615: enet_protocol_handle_send_unreliable_fragment (protocol.c:732)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d900 is 80 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 4
==18474==    at 0x59FE628: enet_protocol_handle_send_unreliable_fragment (protocol.c:732)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d950 is 0 bytes inside a block of size 4 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB477: enet_peer_remove_incoming_commands (peer.c:292)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC953: enet_peer_queue_incoming_command (peer.c:953)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 4
==18474==    at 0x59FE649: enet_protocol_handle_send_unreliable_fragment (protocol.c:734)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d8f8 is 72 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid write of size 4
==18474==    at 0x59FE653: enet_protocol_handle_send_unreliable_fragment (protocol.c:734)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d8f8 is 72 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE65A: enet_protocol_handle_send_unreliable_fragment (protocol.c:736)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d900 is 80 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 4
==18474==    at 0x59FE66F: enet_protocol_handle_send_unreliable_fragment (protocol.c:736)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d950 is 0 bytes inside a block of size 4 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB477: enet_peer_remove_incoming_commands (peer.c:292)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC953: enet_peer_queue_incoming_command (peer.c:953)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE688: enet_protocol_handle_send_unreliable_fragment (protocol.c:736)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d900 is 80 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid write of size 4
==18474==    at 0x59FE697: enet_protocol_handle_send_unreliable_fragment (protocol.c:736)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d950 is 0 bytes inside a block of size 4 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB477: enet_peer_remove_incoming_commands (peer.c:292)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC953: enet_peer_queue_incoming_command (peer.c:953)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE6A7: enet_protocol_handle_send_unreliable_fragment (protocol.c:738)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d908 is 88 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE6AB: enet_protocol_handle_send_unreliable_fragment (protocol.c:738)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x39d54578 is 24 bytes inside a block of size 48 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FAA62: enet_packet_destroy (packet.c:67)
==18474==    by 0x59FB45A: enet_peer_remove_incoming_commands (peer.c:288)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FA920: enet_packet_create (packet.c:22)
==18474==    by 0x59FC885: enet_peer_queue_incoming_command (peer.c:934)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE6D5: enet_protocol_handle_send_unreliable_fragment (protocol.c:741)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d908 is 88 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 8
==18474==    at 0x59FE6D9: enet_protocol_handle_send_unreliable_fragment (protocol.c:741)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x39d54570 is 16 bytes inside a block of size 48 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FAA62: enet_packet_destroy (packet.c:67)
==18474==    by 0x59FB45A: enet_peer_remove_incoming_commands (peer.c:288)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FA920: enet_packet_create (packet.c:22)
==18474==    by 0x59FC885: enet_peer_queue_incoming_command (peer.c:934)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid write of size 2
==18474==    at 0x4C340D3: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59FE6ED: enet_protocol_handle_send_unreliable_fragment (protocol.c:741)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x3aa92de0 is 0 bytes inside a block of size 2,485 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FAA56: enet_packet_destroy (packet.c:66)
==18474==    by 0x59FB45A: enet_peer_remove_incoming_commands (peer.c:288)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FA96E: enet_packet_create (packet.c:33)
==18474==    by 0x59FC885: enet_peer_queue_incoming_command (peer.c:934)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid read of size 4
==18474==    at 0x59FE6F2: enet_protocol_handle_send_unreliable_fragment (protocol.c:745)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x38c6d8f8 is 72 bytes inside a block of size 96 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FB483: enet_peer_remove_incoming_commands (peer.c:294)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FC89E: enet_peer_queue_incoming_command (peer.c:938)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 
==18474== Invalid write of size 1
==18474==    at 0x4C3410B: memcpy@GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59FE6ED: enet_protocol_handle_send_unreliable_fragment (protocol.c:741)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474==  Address 0x102b8294 is 2,484 bytes inside a block of size 2,485 free'd
==18474==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76D9: enet_free (callbacks.c:51)
==18474==    by 0x59FAA56: enet_packet_destroy (packet.c:66)
==18474==    by 0x59FB45A: enet_peer_remove_incoming_commands (peer.c:288)
==18474==    by 0x59FC403: enet_peer_dispatch_incoming_unreliable_commands (peer.c:779)
==18474==    by 0x59FCA33: enet_peer_queue_incoming_command (peer.c:980)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==  Block was alloc'd at
==18474==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==18474==    by 0x59F76A3: enet_malloc (callbacks.c:40)
==18474==    by 0x59FA96E: enet_packet_create (packet.c:33)
==18474==    by 0x59FC885: enet_peer_queue_incoming_command (peer.c:934)
==18474==    by 0x59FE5FB: enet_protocol_handle_send_unreliable_fragment (protocol.c:727)
==18474==    by 0x59FF71E: enet_protocol_handle_incoming_commands (protocol.c:1168)
==18474==    by 0x59FF9AF: enet_protocol_receive_incoming_commands (protocol.c:1261)
==18474==    by 0x5A00EA9: enet_host_service (protocol.c:1801)
==18474==    by 0x398989: Duel6::net::Service::poll(unsigned int) (Service.cpp:27)
==18474==    by 0x39C886: Duel6::Application::syncUpdateAndRender(Duel6::Context&) (Application.cpp:303)
==18474==    by 0x39C8F5: Duel6::Application::run() (Application.cpp:311)
==18474==    by 0x3F02AA: main (Main.cpp:42)
==18474== 

The ENet version used is the latest master version (5de0a6f76). I have previously used 1.3.12 (version available in Ubuntu repos) with the exact same result (game crashes when ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT was used and network jitter applied).

I suspect the bug is in the function enet_peer_dispatch_incoming_unreliable_commands where the enet_peer_remove_incoming_commands gets called.

fanick1 commented 4 years ago

I have actually worked around the issue by having large amount of channels (254) for unreliable communication. The game runs at 60fps, so it burns approximately through 60 channels per second, leaving enough headroom for the late packets. I iterate through the channels for each packet sent, hoping that the occasional jitter would not span across ~254 game ticks (i.e. > 3 seconds)

lsalzman commented 4 years ago

You shouldn't use a large number of channels as that's not really what ENet is designed for. I have been unable to reproduce this problem based on your description, so I would appreciate a testcase that reproduces the issue so that I can actually just fix it rather than force people to use pretty horrific workarounds.

fanick1 commented 4 years ago

Hi @lsalzman , I have stitched together a little demo to demonstrate the bug. https://github.com/fanick1/enet_issue_134 repro steps are in the README.md (emphasis on the packet reordering setup via tc)

lsalzman commented 4 years ago

I believe I fixed this in ENet now, so it should just work.

fanick1 commented 4 years ago

Perfect, it works in the testing project and also in the original game code. YOU ARE AWESOME! Thank you soo much. I would say this is worth a release :100: