opened 10:52PM - 21 Jan 22 UTC
tech-debt
packages
Originally in GitLab by @kakaroto
**TL;DR: While migrating a world for a new sy…stem template (or Foundry core db version), Foundry doesn't listen on the http port until it's done which can take a very long time for some large worlds, causing timeouts and unresponsiveness.**
This is probably going to be a prerequisite to #6120 and related somehow, but I thought it deserved its own issue as it is independent behavior from the returned data of `/api/status` endpoint.
We've had a few reports/issues this week on the Forge from users who are updating to v9, where their servers become inaccessible. Debugging one such instance showed that Foundry does not listen to its port until the world migration is done, which can be quite lengthy.
See the timestamps of messages below (cropped because of its length) :



As you can see, it started migrating the world data at 2:41:33 and didn't finish until 2:54:01 (almost 13 minutes), and **then** it started listening on port 30000. During this time, of course, the server was unresponsive, and the Forge assumes after 2 minutes of unresponsiveness that the process got stuck or crashed or whatever else, so it restarts it, causing it to start the migration from the beginning.
The user's world above was 90MB total in size with 54MB of it in `items.db` which had about 17k items (explains all the db compacting for items that happened).
The only solution we have right now is to tell users afflicted by the problem to "open the game URL, then close the tab immediately so the Forge stops trying to communicate with Foundry until it times out/restarts the process. Try opening the link 15 minutes later and hope it's done migrating". As you can imagine, it's not a great solution/UX but it will do for now. I would assume the electron app would appear to fail to open until it's done migrating, though migration would likely go faster on a modern CPU with larger amounts of available RAM.
Ideally, the server would start listening right away, and show the user a page that tells them that the world is being migrated and to try again later (or a progress bar on the migration). This is how it relates to #6120 where the migration status would go in the `/api/status` endpoint, this would similarly show it to the user in the Foundry page itself (`/join`). It's also a prerequisite because you can't show the migration status in `/api/status` if the server is not listening on the port, since the endpoint wouldn't be accessible in the first place.
Hoping this gets planned for v10.
Thanks!