-
Notifications
You must be signed in to change notification settings - Fork 701
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
MultiServer, customserver, CI, Test: Fix problems in room hosting and test/simulate it #3464
MultiServer, customserver, CI, Test: Fix problems in room hosting and test/simulate it #3464
Conversation
and make sure it stops, another potential memory leak
Hopefully fixes the memory leak we are seeing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Read over the code, that looks good. I can run it on windows if you'd like. Before I try it on the test webhost I'd like to see the ctrl-c save issue fixed, otherwise we might distort the received indexes of some clients and delete/duplicate some items.
If we don't want to test until then, should I push to this PR and re-request review? |
sounds good to me. |
Assuming we don't wait for the |
@@ -277,12 +277,15 @@ async def start_room(room_id): | |||
ctx.logger.exception("Could not determine port. Likely hosting failure.") | |||
with db_session: | |||
ctx.auto_shutdown = Room.get(id=room_id).timeout | |||
if ctx.saving: | |||
setattr(asyncio.current_task(), "save", lambda: ctx._save(True)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had no idea one could do this, and admittedly it feels somewhat cursed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It really does. I think the alternative would be keeping yet another list of active rooms. Not sure if that would be better, but I feel like it would be another source of memory leaks.
… test/simulate it (ArchipelagoMW#3464) * Test: add hosting simulation test * WebHost: add weak typing to get_app() * MultiServer: add typing to auto_saver_thread * MultiServer: don't cancel task, properly end it * customserver: stop auto-save thread from saving after shutdown and make sure it stops, another potential memory leak * MultiServer, customserver: make datapackage small again * customserver: collect/finish room tasks Hopefully fixes the memory leak we are seeing * CI: test hosting * Test: hosting: verify autohoster saves on Ctrl+C * customserver: save when stopping via Ctrl+C
… test/simulate it (ArchipelagoMW#3464) * Test: add hosting simulation test * WebHost: add weak typing to get_app() * MultiServer: add typing to auto_saver_thread * MultiServer: don't cancel task, properly end it * customserver: stop auto-save thread from saving after shutdown and make sure it stops, another potential memory leak * MultiServer, customserver: make datapackage small again * customserver: collect/finish room tasks Hopefully fixes the memory leak we are seeing * CI: test hosting * Test: hosting: verify autohoster saves on Ctrl+C * customserver: save when stopping via Ctrl+C
… test/simulate it (ArchipelagoMW#3464) * Test: add hosting simulation test * WebHost: add weak typing to get_app() * MultiServer: add typing to auto_saver_thread * MultiServer: don't cancel task, properly end it * customserver: stop auto-save thread from saving after shutdown and make sure it stops, another potential memory leak * MultiServer, customserver: make datapackage small again * customserver: collect/finish room tasks Hopefully fixes the memory leak we are seeing * CI: test hosting * Test: hosting: verify autohoster saves on Ctrl+C * customserver: save when stopping via Ctrl+C
… test/simulate it (ArchipelagoMW#3464) * Test: add hosting simulation test * WebHost: add weak typing to get_app() * MultiServer: add typing to auto_saver_thread * MultiServer: don't cancel task, properly end it * customserver: stop auto-save thread from saving after shutdown and make sure it stops, another potential memory leak * MultiServer, customserver: make datapackage small again * customserver: collect/finish room tasks Hopefully fixes the memory leak we are seeing * CI: test hosting * Test: hosting: verify autohoster saves on Ctrl+C * customserver: save when stopping via Ctrl+C
… test/simulate it (ArchipelagoMW#3464) * Test: add hosting simulation test * WebHost: add weak typing to get_app() * MultiServer: add typing to auto_saver_thread * MultiServer: don't cancel task, properly end it * customserver: stop auto-save thread from saving after shutdown and make sure it stops, another potential memory leak * MultiServer, customserver: make datapackage small again * customserver: collect/finish room tasks Hopefully fixes the memory leak we are seeing * CI: test hosting * Test: hosting: verify autohoster saves on Ctrl+C * customserver: save when stopping via Ctrl+C
What is this fixing or adding?
/exit
would not cleanly shutdown, because cancelling a task raises one level higher.result()
edpython test/hosting
How was this tested?
What's still missing
verifying (and fixing) that autohoster saves on CTRL+C (I think it doesn't)stop_autohost(True)
could be used for that alreadystatic_server_data
gets mutatedCTRL+C
we should dodone, the rest doesn't seem that important.Sadly this took way too long already :/