-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
issue: Blocking the UI threads leads to DOM inconsistencies and ultimately crashing #602
Comments
Looks like some kind of edge case I missed, will look into it asap! |
hey, I can't reproduce it, so I pushed a branch with some logs which could help me debug it -> https://github.com/marc2332/freya/tree/fix/mutations-writer-error Could you run your app with it and share me the logs once it crashes? |
Would also appreciate it if you could narrow it down in your app |
Hey, here's the resulting log:
It seems like it was caused by a custom I tried removing the |
Very strange. The node exists when we get it out using |
I would very surprised if it was a race condition, I think it's just some weird case or something, because I have never got that error, not even on Valin, which is quite complex |
Here's a video of my replicating the bug if it helpful: Screen.Recording.2024-05-04.at.9.43.36.PM.mov |
I wonder if you might be calling some blocking code that could be making the realdom act weird, https://github.com/ZeroX-DG/raven/blob/22685396b27e589b6d7bb3b9dcd4099ae84b2544/src/components/content_area.rs#L49 Could you try commenting tha code? |
If that's the issue I think you could try running the pty in a secondary thread and uses mpsc channels to communicate, so it doesn't block the main thread in any way |
I just pushed some changes to the branch, could try it @ZeroX-DG ? |
If that still fails, I have another idea too |
Ok commenting out the
|
Just pushed my other idea, can you try it @ZeroX-DG ? |
Yeah that still crash unfortunately 😄 |
Oh wait, hold on a sec |
You are missing the rect {
key: "{line_index}",
padding: "{line_spacing} 0",
paragraph { Not specifying it could lead to DOM inconsistencies, I wonder if that's related |
Yeah for sure haha. This make me wish we have something like a |
Hmmmm could be..........I'll try specifying a key. |
Nope still crash. |
Leave the key anyway, I guess running it in another thread is the way to go then. I don't really know if this is a bug or more like an issue caused by "wrong use" of the library (blocking the main thread unexpectedly)? Having a |
You could also try using async tasks and a async Mutex instead of std's Mutex |
Oh are you talking about this crate: https://docs.rs/async-mutex/latest/async_mutex/ ? Or is it something built in? |
I was actually thinking about tokio's Mutex |
Yeah I agree. It's probably not a bug. More of a user error. Still, it's a chance for improvement. Maybe we can somehow let users know when their code is valid to run on the main thread & when it's not? |
Oh cool. I've never used it before. Coming from JavaScript land, these multi-threading stuff is pretty new to me haha. I'll give it a try! |
A note on the docs would be very nice indeed, most frameworks let you know that the UI thread should not be blocked and that expensive calculations should be done in secondary threads or similar |
I encounter this error when I resize my app really quick. It doesn't happen on freya examples so I'm not sure what is causing this.
The text was updated successfully, but these errors were encountered: