Closed SK83RJOSH closed 3 months ago
Are the client and server running in separate processes?
Yes i've seen that error; for some reason when my observers trigger (in this case this one https://github.com/cBournhonesque/lightyear/blob/main/lightyear/src/server/clients.rs#L73), I have errors telling me that a resource like ConnectionManager
doesn't exist.
This doesn't make sense to me since ConnectionManager
should exist at all times!
As a quick fix I can update the argument to be Option<ConnectionManager>
Does this fix it? https://github.com/cBournhonesque/lightyear/pull/549
Ah I know, it's because I trigger the observer while inside a world.resource_scope
so the resource has been removed
This should be fixed from https://github.com/cBournhonesque/lightyear/pull/549
Heya, just wanted to follow up and say it seems to still be occurring on my end when using the latest commit:
This one is a bit hard to make a minimal repro for and our time zones are a bit out of sync, but I'll see what I can do tomorrow. Sorry in the meantime though, this one feels bound to be a bit frustrating... 😓
Ah I see, that's interesting; I opened an issue here https://github.com/cBournhonesque/lightyear/issues/550
I think I know how to fix it. I have to avoid doing archetype changes while inside world.resource_scope
@SK83RJOSH I finally got around to fixing it! I also added a unit test that exactly reproduces your situation, so it should be good now :)
I can confirm it's fixed on our end! Thank you so much ❤️
Hello!
I have a case where an entity spawned on a client like so:
And configured on the server like so:
And despawned on the owning client side:
Results in the server panicking:
Full Backtrace
```rust thread 'main' panicked at C:\Users\Josh\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.14.0\src\system\system_param.rs:534:17: Resource requested by lightyear::server::clients::systems::handle_controlled_by_remove does not exist: lightyear::server::connection::ConnectionManager stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/aed2187d53b8789e3a37f50ae36f894a2a679077/library\std\src\panicking.rs:652 1: core::panicking::panic_fmt at /rustc/aed2187d53b8789e3a37f50ae36f894a2a679077/library\core\src\panicking.rs:72 2: bevy_ecs::system::system_param::impl$4::get_param::closure$0The error hints at
ConnectionManager
being the issue, but after a lot of trying to grok the associated code, I wasn't able to determine if we're missing something in our server plugin setup, or if we've uncovered some nasty bug. So I wanted to create an issue and see if you might have any leads. Do note that everything up until the despawn works just fine, which I assume means theConnectionManager
indeed exists before the panic, but I haven't gotten around to dumping the ECS world to confirm. 🙂