diff --git a/WebHostLib/customserver.py b/WebHostLib/customserver.py
index 59eb1d3d..7e886e72 100644
--- a/WebHostLib/customserver.py
+++ b/WebHostLib/customserver.py
@@ -184,4 +184,12 @@ def run_server_process(room_id, ponyconfig: dict, static_server_data: dict):
from .autolauncher import Locker
with Locker(room_id):
- asyncio.run(main())
+ try:
+ asyncio.run(main())
+ except:
+ with db_session:
+ room = Room.get(id=room_id)
+ room.last_port = -1
+ # ensure the Room does not spin up again on its own, minute of safety buffer
+ room.last_activity = datetime.datetime.utcnow() - datetime.timedelta(minutes=1, seconds=room.timeout)
+ raise
diff --git a/WebHostLib/models.py b/WebHostLib/models.py
index 0dc67a51..dbd03b16 100644
--- a/WebHostLib/models.py
+++ b/WebHostLib/models.py
@@ -29,6 +29,7 @@ class Room(db.Entity):
show_spoiler = Required(int, default=0) # 0 -> never, 1 -> after completion, -> 2 always
timeout = Required(int, default=lambda: 2 * 60 * 60) # seconds since last activity to shutdown
tracker = Optional(UUID, index=True)
+ # Port special value -1 means the server errored out. Another attempt can be made with a page refresh
last_port = Optional(int, default=lambda: 0)
diff --git a/WebHostLib/templates/hostRoom.html b/WebHostLib/templates/hostRoom.html
index 8981de9b..1c8f3de2 100644
--- a/WebHostLib/templates/hostRoom.html
+++ b/WebHostLib/templates/hostRoom.html
@@ -20,12 +20,16 @@
The server for this room will be paused after {{ room.timeout//60//60 }} hours of inactivity.
Should you wish to continue later,
anyone can simply refresh this page and the server will resume.
- {% if room.last_port %}
+ {% if room.last_port == -1 %}
+ There was an error hosting this Room. Another attempt will be made on refreshing this page.
+ The most likely failure reason is that the multiworld is too old to be loaded now.
+ {% elif room.last_port %}
You can connect to this room by using
'/connect {{ config['PATCH_TARGET'] }}:{{ room.last_port }}'
- in the client.
{% endif %}
+ in the client.
+ {% endif %}
{{ macros.list_patches_room(room) }}
{% if room.owner == session["_id"] %}