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

Fix freeze on startup #2368

Merged
merged 3 commits into from
Sep 17, 2023
Merged

Fix freeze on startup #2368

merged 3 commits into from
Sep 17, 2023

Conversation

jie65535
Copy link
Contributor

Description

On some devices, after starting the server and displaying ‘Loading Grasscutter’, there is no further action. The CPU usage is shown as 0% in the task manager.

By adding logs, I found that ResourceLoader.loadResources() will be executed during static loading, and all resources will be loaded simultaneously using parallel().

The specific calling path is: Grasscutter static init -> Utils.startupCheck() -> DataLoader.checkAllFiles() -> generateGachaMappings() -> Tools.createGachaMappings(path) -> ResourceLoader.loadResources() -> parallel() -> Freeze.

Freeze screenshot

If parallelism is removed, it can be loaded normally, so I wonder if the thread pool has not been started during static initialization? Causes the parallel method to not continue?

Sync load

Therefore, I adjusted the loading order, placed the generation logic after resource loading, and deleted the resource loading step during generation.

Type of changes

  • Bug fix
  • New feature
  • Enhancement
  • Documentation

Checklist:

  • My code follows the style guidelines of this project
  • My pull request is unique and no other pull requests have been opened for these changes
  • I have read the Contributing note and Code of conduct
  • I am responsible for any copyright issues with my code if it occurs in the future.

jie65535 and others added 2 commits September 17, 2023 09:58
Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
@KingRainbow44 KingRainbow44 merged commit fdad421 into Grasscutters:development Sep 17, 2023
@jie65535 jie65535 deleted the Fix_startup_check branch September 17, 2023 16:32
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.

2 participants