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

ResourceLoader: Fix error on querying progress for uncached loads #95476

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

RandomShaper
Copy link
Member

Fixes #95470.

Discussion:

#93540 did two things: 1) consider cache-ignore-deep in addition to cache-ignore in the relevant logic; 2) isolate uncached loads further than they previously were so they would be truly fresh.

Change 2) is the one at play here. Elaborating, before it, uncached loads would be registered in the map of load tasks only if no other load tasks existed for the same path, Otherwise, the uncached load couldn't be registered so it had to complete synchronously. If that had happened even before #93540, the same bug would have arisen. However, after the PR, which makes the isolation more strict, it's easier to hit the problem.

The underlying issue is precisely that the isolation is implemented by neglecting the map of load tasks for uncached loads (a bit less strictly before #93540, but just as a flawed optimization of the same idea). The proper fix is to redesign the data structures (map of load tasks, maybe load tokens as well) so the isolation can be implemented more cleanly.

Prior to a change as deep as that one we have two issues: 1) uncached loads can't take advantage of other ongoing uncached loads (which may be wanted or not, but the curent implementation prevents it altogether): 2) it's impossible to query progress of an uncached load (before #93540 it was possible in most cases).

My plan, even before this bug, was to work on the proper implementation at some point, and that will still happen. In the current RC stage, the best thing to do is restore the already flawed behavior pre-93540. That boils down to a partial revert of #93540, bringing back the less strict isolation between cached and uncached. That's what this PR does.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm this solves the issue.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, seems to fix the issue.

@akien-mga akien-mga merged commit 28e65b0 into godotengine:master Aug 13, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@RandomShaper RandomShaper deleted the uncached_progress branch August 13, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceLoader.load_threaded_get_status(SCENE, PROGRESS) always returns 0 (THREAD_LOAD_INVALID_RESOURCE)
3 participants