8000 Fixed player crash when kick by Mofurka · Pull Request #179 · StarryPy/StarryPy3k · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed player crash when kick #179

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

Mofurka
Copy link
@Mofurka Mofurka commented Apr 6, 2025

Fixed a bug with players crashing when kicked. Thanks to https://github.com/Novaenia for the tip

Fixed a bug with players crashing when kicked. Thanks to https://github.com/Novaenia for the tip
@Mofurka
Copy link
Author
Mofurka commented Apr 6, 2025

You need to send world_stop packet before the kick

I tracked through tracemalloc that the link still remains, and when using opensb, each player's entry increases the memory by 58-60 megabytes. If the player exits, the memory is not cleared and increases each time. Such a small fix now really does not allow the memory to increase by 50-60 MB, but only by 200-300 KB
@Mofurka
Copy link
Author
Mofurka commented Apr 6, 2025

Also, I tracked through tracemalloc that the link still remains, and when using opensb, each player's entry increases the memory by 58-60 megabytes. If the player exits, the memory is not cleared and increases each time. Such a small fix now really does not allow the memory to increase by 50-60 MB, but only by 200-300 KB

Here is log when i joined game two times
Memory top:
/home/starbounder/StarryPy3k/utilities.py:367: size=29.6 MiB, count=59, average=514 KiB
/home/starbounder/StarryPy3k/zstd_reader.py:69: size=29.6 MiB, count=59, average=514 KiB
/home/starbounder/StarryPy3k/data_parser.py:333: size=4601 KiB, count=79496, average=59 B
/home/starbounder/StarryPy3k/data_parser.py:417: size=2288 KiB, count=13721, average=171 B
/home/starbounder/StarryPy3k/data_parser.py:392: size=1290 KiB, count=29166, average=45 B
/home/starbounder/StarryPy3k/data_parser.py:408: size=881 KiB, count=14092, average=64 B
/home/starbounder/StarryPy3k/data_parser.py:709: size=597 KiB, count=2484, average=246 B
/home/starbounder/StarryPy3k/data_parser.py:364: size=592 KiB, count=25261, average=24 B
/usr/lib/python3.11/asyncio/sslproto.py:277: size=512 KiB, count=4, average=128 KiB
/home/starbounder/StarryPy3k/data_parser.py:710: size=233 KiB, count=2485, average=96 B

Here is second
Memory top:
/home/starbounder/StarryPy3k/utilities.py:367: size=58.9 MiB, count=80, average=754 KiB
/home/starbounder/StarryPy3k/zstd_reader.py:69: size=58.9 MiB, count=80, average=754 KiB
/home/starbounder/StarryPy3k/data_parser.py:333: size=9202 KiB, count=158989, average=59 B
/home/starbounder/StarryPy3k/data_parser.py:417: size=4582 KiB, count=27488, average=171 B
/home/starbounder/StarryPy3k/data_parser.py:392: size=2580 KiB, count=58332, average=45 B
/home/starbounde 8000 r/StarryPy3k/data_parser.py:408: size=1761 KiB, count=28183, average=64 B
/home/starbounder/StarryPy3k/data_parser.py:709: size=1193 KiB, count=4968, average=246 B
/home/starbounder/StarryPy3k/data_parser.py:364: size=1184 KiB, count=50522, average=24 B
/usr/lib/python3.11/asyncio/sslproto.py:277: size=512 KiB, count=4, average=128 KiB
/home/starbounder/StarryPy3k/data_parser.py:710: size=467 KiB, count=4970, average=96 B

After fix:
First join
Memory top:
/home/starbounder/StarryPy3k/utilities.py:367: size=740 KiB, count=34, average=21.8 KiB
/home/starbounder/StarryPy3k/zstd_reader.py:69: size=739 KiB, count=33, average=22.4 KiB
/home/starbounder/StarryPy3k/data_parser.py:709: size=575 KiB, count=2484, average=237 B
/usr/lib/python3.11/asyncio/sslproto.py:277: size=512 KiB, count=4, average=128 KiB
/home/starbounder/StarryPy3k/data_parser.py:710: size=233 KiB, count=2485, average=96 B
:729: size=226 KiB, count=2337, average=99 B
/home/starbounder/StarryPy3k/plugin_manager.py:59: size=221 KiB, count=3554, average=64 B
/usr/lib/python3.11/json/decoder.py:353: size=125 KiB, count=1775, average=72 B
/home/starbounder/StarryPy3k/data_parser.py:706: size=92.2 KiB, count=2484, average=38 B
/home/starbounder/StarryPy3k/data_parser.py:711: size=69.6 KiB, count=2227, average=32 B

second rejoin:
Memory top:
/home/starbounder/StarryPy3k/utilities.py:367: size=1223 KiB, count=46, average=26.6 KiB
/home/starbounder/StarryPy3k/zstd_reader.py:69: size=1223 KiB, count=45, average=27.2 KiB
/home/starbounder/StarryPy3k/data_parser.py:709: size=1116 KiB, count=4968, average=230 B
/usr/lib/python3.11/asyncio/sslproto.py:277: size=512 KiB, count=4, average=128 KiB
/home/starbounder/StarryPy3k/data_parser.py:710: size=467 KiB, count=4970, average=96 B
:729: size=226 KiB, count=2337, average=99 B
/home/starbounder/StarryPy3k/plugin_manager.py:59: size=225 KiB, count=3622, average=64 B
/home/starbounder/StarryPy3k/data_parser.py:706: size=184 KiB, count=4968, average=38 B
/home/starbounder/StarryPy3k/data_parser.py:711: size=139 KiB, count=4454, average=32 B
/usr/lib/python3.11/json/decoder.py:353: size=125 KiB, count=1779, average=72 B

@Mofurka
Copy link
Author
Mofurka commented Apr 6, 2025

Ah, wait, for somehow it fixed crash for one time. Need more time to debug this

@Mofurka
Copy link
Author
Mofurka commented Apr 6, 2025

Ok, found the reasoin why game is getting crash
[Info] Client received world stop packet, leaving: You were kicked.
Reason:
[Error] WorldClient received packet type Pong while not in world
[Error] WorldClient received packet type StepUpdate while not in world
[Info] Chat: ^red;D. has been kicked for reason: You were kicked.
[Info] Chat: Reason: ^reset;
[Error] WorldClient received packet type StepUpdate while not in world
[Error] WorldClient received packet type StepUpdate while not in world
[Error] WorldClient received packet type StepUpdate while not in world
[Error] WorldClient received packet type EntityUpdate while not in world
Exception thrown: read access violation.

@Mofurka
Copy link
Author
Mofurka commented Apr 6, 2025

Great, now I definitely fixed the kick. I stop the writer after the player kick process starts. The sequence must be like this. world_stop packet, then server_disconnect packet

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.

1 participant
0