Hang when running custom system impl inspired by bevy's combinator systems, regression from 0.9 #8339
Labels
A-ECS
Entities, components, systems, and events
A-Tasks
Tools for parallel and async work
C-Bug
An unexpected or incorrect behavior
P-Regression
Functionality that used to work but no longer does. Add a test for this!
Bevy version
0.10.1
Regression from 0.9.1
System
OS: macOS 13.1 Ventura
CPU: Apple M1 Pro
What you did
I have the following code. This is a custom system combinator akin to Bevy's PipeSystem, with the difference that the first system returns an
Option<T>
and the second system is only called if the first system returned Some.I have carried this code forward over the past few versions of Bevy. It used to work. Now in 0.10 it no longer does. This is interesting, because I looked at Bevy's combinator system implementation (https://github.com/bevyengine/bevy/blob/v0.10.1/crates/bevy_ecs/src/system/combinator.rs#L124) for reference and made sure that my code mirrors that. I expect my thing to work, given that it is adapted from something that is already included in Bevy itself. With previous versions of Bevy, I used the implementation of PipeSystem as my reference to learn from.
Code
I am using this thing as a building block for handling Bevy UI buttons, among other things.
Code
It could be used like this:
Code
What went wrong
If I add the button handler system to my app, Bevy hangs when it tries to run it. The window becomes frozen and unresponsive.
Additional information
Like I said, this exact thing worked in previous versions of Bevy. I am just porting it to 0.10 now. I made my custom
impl System
by looking at the code of Bevy'sPipeSystem
, and now the new generic combinator system.I tried running my app in
lldb
to try to track down what is going on. I could keep stepping long after myrun_unsafe
impl, past the end of the body of the task spawned by bevy's multithreaded executor. Eventually I reached here: https://github.com/bevyengine/bevy/blob/v0.10.1/crates/bevy_tasks/src/task_pool.rs#L500 and that is when the hang happened. Continuing to step the debugger only showed assembly listings from libpthread. I suspect we are getting stuck in thisexecute_forever
thing. I do not understand this code and I have no idea what it does and why. It seems to have been introduced in #7415 .I am stumped. Please help. This whole thing is so weird.
The text was updated successfully, but these errors were encountered: