linebender / xilem

An experimental Rust native UI framework
Apache License 2.0
3.18k stars 93 forks source link

Xilem's to_do_mvc enters an apparent infinite loop #424

Open matta opened 4 days ago

matta commented 4 days ago

Xilem's to_do_mvc example (xilem/examples/to_do_mvc.rs) seems to go into a loop when I click on the text edit.

This is on Debian, running from Xilem's current head (e76cf31258c79d263c5669be052353c3e99c012d).

  1. cd <repo root>
  2. cd xilem
  3. cargo run --example to_do_mvc
  4. Click on the text input.

CPU usage for the app goes up to about 40%, and the log spews this seemingly forever:

17:55:17.227Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.227Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.244Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.244Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.260Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.260Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.277Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.277Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.294Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.294Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.310Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.310Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.327Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.327Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.343Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.344Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.360Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.360Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.377Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.377Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.393Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.394Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.410Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.410Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.427Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.427Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.444Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.444Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.460Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.460Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
17:55:17.477Z DEBUG text_event: Running ON_TEXT_EVENT pass with Ime::Preedit("")
17:55:17.477Z DEBUG text_event: ON_TEXT_EVENT finished focused_widget=1 handled=true
DJMcNab commented 4 days ago

Thanks! This is a known issue, and is due to an expedient hack added in #314, which was needed as we have not fully designed our passes. This should be resolved when the pass order update is designed and implemented.

As for using 40% of your CPU, that is a surprisingly large amount, as I believe we are entirely single threaded. What's the amount used if you use release mode?

matta commented 3 days ago

As for using 40% of your CPU, that is a surprisingly large amount, as I believe we are entirely single threaded. What's the amount used if you use release mode?

Apologies, I wasn't clear. There is nothing surprising about the CPU usage, I think. The percentage I spoke of is reported by top, which reports 100% CPU usage when a process is fully utilizing a single CPU core (and/or hyperthread if that is enabled).

The release build of the to_do_mvc example hovers around 13% of one core/hyperthread on my machine.

Glad there is an explanation. Feel free to close this issue if there is no utility in keeping it open.