question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Main thread is locked up during bootup

See original GitHub issue

Heya!

So I’ve got a sample app which sort of resembles a news article with user comments. When I have – say – 500 comments (<Comment/>), each with up-vote and down-vote buttons (<VoteButtons/>) I see the boot up on a Nexus 5X take somewhere in the region of 500ms:

screen shot 2016-11-17 at 12 17 23 pm

What I’d like to do instead is make use of requestIdleCallback to spread the load out a bit. I’m fine with the SSR code making the buttons and so on inert (as in, I can handle that separately) but I’m mostly concerned that there doesn’t seem to be any way to spread out the initial diff and so on into smaller chunks. On an older phone that’s likely to be a few seconds of main thread lock-out where someone wouldn’t be able to scroll or interact in any way.

I had a quick look over the source, and I see there’s an ASYNC_RENDER flag (which looks stellar because I can hook in rIC there via options.debounceRendering), but it seems like that only applies for updates rather than the initial create-this-from-the-DOM boot that I get with SSR… well, I imagine it applies to all initial renders it’s just that the diff’ing done from the SSR’d version looks to be causing some slowdown.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
developitcommented, Nov 17, 2016

Heads up to others: the crazy trace here was actually an SSR hydration bug. It has been fixed in 7.0.3!

Here’s a contrived example showing the difference between 7.0.2 and 7.0.3, where I’ve added call count tracking to document.createElement to verify that SSR was broken for certain component types at the root, and that it has been fixed (0 createElement() calls):

7.0.2: http://jsfiddle.net/developit/sbdjevmh/

7.0.3: http://jsfiddle.net/developit/1wh26gy5/

2reactions
paullewiscommented, Jan 27, 2020

The spirit of this bug was in the fact that updates were atomic and blocking, meaning that they were not interruptible or prioritizable by the browser processes. While I welcome Preact X’s hydration over render, it is nonetheless problematic for any virtual DOM implementation if it can not be parallelized or prioritized by the browser. I appreciate, however, that that’s a significant departure from the current world and approaches, but I also didn’t feel that what you described met the original intent of the bug I raised.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding System Trace's Main Thread 'Blocked'
The backtrace says the main thread is waiting in the run loop. In other words, it's waiting for user input, a timer, a...
Read more >
There is no main thread in the SpringBoot web project
The name of the file where the main thread is created/executed should be inside that path, and should be called YOUR_PROJECT_NAME+Application.
Read more >
Deadlock between BackgroundPreinitializer and main thread ...
java:117) at org.springframework.boot.autoconfigure.condition.FilteringSpringBootCondition.filter(FilteringSpringBootCondition.java:95) at org.
Read more >
Optimizing startup performance - MDN Web Docs
Does it seem to lock up the device or the user's browser while the app ... startup code in a single event handler...
Read more >
Asynchronous work with Java threads | Android Developers
Execute in a background thread ... Making a network request on the main thread causes the thread to wait, or block, until it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found