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

Asset loading issue after 0.11.1 #9452

Closed
Shatur opened this issue Aug 15, 2023 · 2 comments · Fixed by #9453
Closed

Asset loading issue after 0.11.1 #9452

Shatur opened this issue Aug 15, 2023 · 2 comments · Fixed by #9453
Labels
A-Animation Make things move and change over time A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior
Milestone

Comments

@Shatur
Copy link
Contributor

Shatur commented Aug 15, 2023

Bevy version

0.11.1

What you did

Consider the following example breaking_change.zip with Bevy 0.11.0. Model and its animations loaded successfully. If you try to update it to Bevy 0.11.1 it will break.

What went wrong

If you update Bevy version to 0.11.0 I see either model without animations of no model at all. Looks like #9429 solved the issue for animated fox, but larger model I observe race condition.

Additional information

0.11.0:

image

0.11.1

image

@Shatur Shatur added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 15, 2023
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds A-Animation Make things move and change over time and removed S-Needs-Triage This issue needs to be labelled labels Aug 15, 2023
@robtfm
Copy link
Contributor

robtfm commented Aug 15, 2023

you're right, only one pending request gets unblocked. this diff fixes it for me, can you please test as well (i guess you have a larger project to try it with)

diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs
index 2217c80c9..e5daf1112 100644
--- a/crates/bevy_asset/src/asset_server.rs
+++ b/crates/bevy_asset/src/asset_server.rs
@@ -236,7 +236,7 @@ impl AssetServer {
             loaders[existing_index] = MaybeAssetLoader::Ready(Arc::new(loader));
             if let Some(sender) = maybe_sender {
                 // notify after replacing the loader
-                let _ = sender.send_blocking(());
+                let _ = sender.close();
             }
         } else {
             loaders.push(MaybeAssetLoader::Ready(Arc::new(loader)));

@Shatur
Copy link
Contributor Author

Shatur commented Aug 15, 2023

Can confirm that this change fixes the issue for my project too.

@cart cart added this to the 0.11.2 milestone Aug 16, 2023
github-merge-queue bot pushed a commit that referenced this issue Aug 17, 2023
# Objective

fix #9452

when multiple assets are queued to a preregistered loader, only one gets
unblocked when the real loader is registered.

## Solution

i thought async_channel receivers worked like broadcast channels, but in
fact the notification is only received by a single receiver, so only a
single waiting asset is unblocked. close the sender instead so that all
blocked receivers are unblocked.
cart pushed a commit that referenced this issue Aug 17, 2023
# Objective

fix #9452

when multiple assets are queued to a preregistered loader, only one gets
unblocked when the real loader is registered.

## Solution

i thought async_channel receivers worked like broadcast channels, but in
fact the notification is only received by a single receiver, so only a
single waiting asset is unblocked. close the sender instead so that all
blocked receivers are unblocked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Animation Make things move and change over time A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants