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

Is the "event not consumed" warning spurious? #6596

Closed
alice-i-cecile opened this issue Nov 13, 2022 Discussed in #6595 · 5 comments
Closed

Is the "event not consumed" warning spurious? #6596

alice-i-cecile opened this issue Nov 13, 2022 Discussed in #6595 · 5 comments
Labels
A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use
Milestone

Comments

@alice-i-cecile
Copy link
Member

Discussed in #6595

Originally posted by nicopap November 13, 2022

Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

Live example: https://nicopap.github.io/bevy_mod_paramap/earth3d.html (open console, drag around the glob by holding middle click down)

Source code is: https://github.com/nicopap/bevy_mod_paramap/blob/7c5d9789ddd3cb05eb1b023cc0bab0aa5cfa021c/examples/earth3d.rs#L232-L308

I'm getting a warning when I'm doing something quite normal. I just do not read the MouseMotion event when I don't need to.

The error says This problem is […] due to […] consuming events conditionally but fails to explain why it is an issue. Looking at the Events doc, I don't see much of an argument against reading events conditionally.

It feels like a very common false positive. This is very confusing to a new user, especially given most of the warning message doesn't at all match what I'm actually doing in my code. In fact I do often skip reading events when I don't need to read them (for performance!) and I've seen this error in a lot of my projects.

I understand why it can help, but did we not forget to weight the cost of false positives when adding this feature? The likely thing I'll do next time I see this error is to just ignore it, and it might as well not exist in this case.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use labels Nov 13, 2022
@alice-i-cecile alice-i-cecile added this to the 0.9.1 milestone Nov 13, 2022
@alice-i-cecile
Copy link
Member Author

I think we should probably just revert this PR: the false positive cost is very high and it adds an extra branching check that will rarely be useful.

@rozgo
Copy link

rozgo commented Nov 14, 2022

This happens while doing, what I believe, is normal handoff of input from game to egui and back.
For example, if egui_context.ctx_mut().wants_pointer_input() I conditionally stop reading events.

@alice-i-cecile
Copy link
Member Author

alice-i-cecile commented Nov 14, 2022

Yep, I ran into exactly that problem. The error can be useful, but it has some nasty false positives, spams hard, and is really challenging to figure out how to silence.

@forbjok
Copy link
Contributor

forbjok commented Nov 16, 2022

I'm also getting a large number of these warnings after upgrading to 0.9. The ones that get the highest number of "missed" events seem to be from systems that only run during certain states, and produce warnings with a number of missed events that is higher depending on how long it was since that state was active - sometimes in the 1000s - whenever the state becomes active. Outside of these, there also seem to be some more frequent ones due to deliberately skipping reading events in various systems based on cooldowns or other conditions making them irrelevant for that update cycle.

As far as I can tell, all of these warnings are irrelevant and caused by things that are working as intended.

I suppose there might, at least theoretically be cases where this warning actually indicates an error, if you accidentally omit reading from an event reader or return early from a system when it was not intended, but as far as I can see, this would be extremely rare and niche compared to the vast number of false positives produced.

@tim-blackbird
Copy link
Contributor

If you miss events for a bit and then read them again, you're going to get the events for this frame and the previous.
Probably fine in many cases but could definitely be a source for some weird bugs.
bevyengine/rfcs#17 might be a step in the right direction.

I'm okay with removing the warning for now though as there's no nice way to handle this currently.

bors bot pushed a commit that referenced this issue Nov 23, 2022
# Objective

- Reverts #5730.
- Fixes #6173, fixes #6596.

## Solution

Remove the warning entirely.

## Changelog

You will no longer be spammed about

> Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events`
@bors bors bot closed this as completed in 3433a7b Nov 23, 2022
cart pushed a commit that referenced this issue Nov 30, 2022
# Objective

- Reverts #5730.
- Fixes #6173, fixes #6596.

## Solution

Remove the warning entirely.

## Changelog

You will no longer be spammed about

> Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events`
archsolar pushed a commit to archsolar/bevy that referenced this issue Jan 20, 2023
…#6730)

- Reverts bevyengine#5730.
- Fixes bevyengine#6173, fixes bevyengine#6596.

Remove the warning entirely.

You will no longer be spammed about

> Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events`
archsolar pushed a commit to archsolar/bevy that referenced this issue Jan 20, 2023
…#6730)

# Objective

- Reverts bevyengine#5730.
- Fixes bevyengine#6173, fixes bevyengine#6596.

## Solution

Remove the warning entirely.

## Changelog

You will no longer be spammed about

> Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events`
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
…#6730)

# Objective

- Reverts bevyengine#5730.
- Fixes bevyengine#6173, fixes bevyengine#6596.

## Solution

Remove the warning entirely.

## Changelog

You will no longer be spammed about

> Missed 31 `bevy_input::mouse::MouseMotion` events. Consider
reading from the `EventReader` more often (generally the best
solution) or calling Events::update() less frequently
(normally this is called once per frame). This problem is most
likely due to run criteria/fixed timesteps or consuming events
conditionally. See the Events documentation for
more information.

when you miss events. These warnings were often (but not always) a false positive. You can still check this manually by using `ManualEventReader::missed_events`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants