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.

Question: Why is main thread blocked by Model.prototype.refresh() so long?

See original GitHub issue

OpenUI5 version: 1.56.18 (legacy app here, sorry)

Browser/version (+device/version): Firefox 102.0 (64-bit), Linux (Arch)

Any other tested browsers/devices(OK/FAIL): -

URL (minimal example if possible): -

User/password (if required and possible - do not post any confidential information here): -

Steps to reproduce the problem:

  1. We use two-way data binding heavily
  2. destorying or updating controls takes very long and completely blocks the main thread

What is the expected result? Adding and destroying aggregations should not take long and should not block the main thread for long (see: Firefox Profiler “Jank - event processing delay”).

What happens instead? We see many seconds of browser main thread freezing when calling this.getView().getModel().refresh(true);. The same applies to destroying the view. We see a lot of bindings being attached and removed (see screenshot).

I understand that we use a fairly old version of openui5. Nonetheless I would like to ask if anybody has ever seen a performance issue like the one depicted by the flamegraphs below. I do not understand whether we are misusing the framework somehow or whether this is a bug that was already fixed by newer openui5 versions. Any hint on what might be going on is highly appreciated! =)

Any other information? (attach screenshot if possible)

Destroy: ui5-perf

Update (setProperty -> refresh JSONModel): ui5-perf-2

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
boghyoncommented, Jul 15, 2022

Ok, now I have many questions. 😄 You can DM me on OpenUI5 Slack and maybe we can take a look at the application together. Let’s close this issue for now since Issues are only for bug reports

0reactions
MartinLoepercommented, Jul 14, 2022

OpenUI5 1.56.18 source code?

Well, that makes sense! Thanks for the hint and the link! =)

I’d avoid calling model.refresh(true) since it forcefully updates all existing bindings related to that model even if the data have not been changed.

Do you know what is the the fastest and/or recommended way to destroy all controls when the model changes? When we update the data, we basically reload all the data in the mode, i.e. every single property is set with fresh values.

Is there a way to efficiently destroy the old controls and re-render the view? We currently always do model.refresh(true) when a new model is to be rendered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why main thread is blocked? - java - Stack Overflow
The problem I have is that, the main thread is always waiting and once worker thread to return the result then callSomeMethod() is...
Read more >
Using Web Workers - Web APIs - MDN Web Docs
Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering ......
Read more >
Processes and Threads
Two threads on the READY queue, one blocked, one running. This shows the ... This thread executes a few instructions, and calls main()....
Read more >
Thread.Sleep is a sign of a poorly designed program. - Msmvps
When you block your STA thread with Thread.Sleep you're blocking that communication and run the risk of the queue overflowing. A WinForm thread ......
Read more >
Multi-Threaded Programming - C++ Class Thread for Pthreads ...
In the code, the main thread will create a second thread to execute worker_thread(), which will print out its message while main thread...
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