Skip to content
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

Freezes during "world migrations for FXMaster" #144

Closed
Melarith opened this issue Jan 3, 2022 · 1 comment · Fixed by #147
Closed

Freezes during "world migrations for FXMaster" #144

Melarith opened this issue Jan 3, 2022 · 1 comment · Fixed by #147
Labels
bug Something isn't working confirmed

Comments

@Melarith
Copy link

Melarith commented Jan 3, 2022

Expected Behavior

My browser should not freeze during the world migration, and the world migration should not take over an hour to complete.

Current Behavior

My browser tab (Firefox) froze during the world migration for FXMaster from Foundry v8 to v9 on the Forge for about an hour and a half before I gave up and closed the tab.

Steps to Reproduce

  1. Update to Foundry v9.
  2. Update pf2e to latest v9 version (3.1.3) from a v8 version.
  3. Start Foundry through the Forge. Browser tab froze trying to migrate pf2e and FXMaster.
  4. Restart in safe mode. Complete pf2e world migration and use a script (canvas.scene.unsetFlag("fxmaster", "effects");) to clear FXMaster effects on my scenes.
  5. Restart Foundry in normal mode with FXMaster as the only enabled module. Migration completes without issue.

Context

I fixed the issue by using a script to clear FXMaster effects on my scenes before re-enabling the module and trying again.

Also, I included a zip of an exported version of my world before I updated to v9 if you want to dig around in it.

Export World.zip

Version

v2.1.0

Foundry VTT Version

v9

Operating System

Windows

Browser / App

Firefox

Game System

pf2e

Relevant Modules

No response

@Melarith Melarith added bug Something isn't working to be confirmed labels Jan 3, 2022
@ghost91-
Copy link
Contributor

ghost91- commented Jan 4, 2022

Thanks for the report. The exported world helped a lot with figuring out what the problem was. It's a pretty nasty bug...

During a recent refactoring, I changed the way that drawing the weather effects is initially performed. That resulted in the drawing not waiting for any necessary migrations to be performed anymore. Usually, you would not notice this because the migration is quite fast, so it's actually finished before the canvas even starts rendering. However, due to the pf2e migration happening in parallel, this becomes much slower and the canvas (including the weather effects) starts rendering before the migration is done.

This means, the weather effects start rendering with the old (pre migration) settings. In particular, the density value from before the migration is a value that can be somewhere between 50 and 10000, depending heavily on the dimensions of the scene (larger scenes have larger values). After the migration, it's usually a value between 0.001 and 2, independent of the scene's dimensions. That means, with the old values still present, the density is actually interpreted as a huge value, much larger than computers can practically handle. With the new FXMaster version, the density is roughly equivalent to the number of particles per grid unit.

So for example, in your "The Floating Market" scene, which is the scene that's currently active in that world, there is a stars weather effect with a density of 7800. The dimensions of the scene are 7265 x 7265 pixels and the grid size is 110 pixels. That means, FXMaster would be trying to spawn about 7265 / 110 x 7265 / 110 x 7800 ≈ 34,023,616 star particles, which is so many that the browser tab crashes (there are an additional ~21,810 bats, but that's just icing on the cake 😆).

I have a fix for this problem, which basically prevents the drawing of the effects until the migration has finished, again. I'll push it and create a release as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants