[Violation] 'requestAnimationFrame' handler took Xms in timer.js

Open
#55 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
d3, javascript
Domain
frontend

Research direction

Start by reading the wake() function in timer.js around line 67, where the reported long-running handler occurs. The issue suspects a large number of timer tasks being iterated after the application has been inactive, but provides no reproduction or instrumentation results; first identify where the time is spent and define a reproducible case before proposing a fix.

Written by the indexing model from the issue text.

Description

I'm utilizing d3js in an electron.js application and when the system is left unattended for a day or so, when it wakes up the application isn't responsive. Initially I thought it was related to the system going to sleep, but in my most recent test the system never went to sleep, it was just locked for a couple of days.

Eventually it becomes responsive again, the application is fine, and the chrome console reports
[Violation] 'requestAnimationFrame' handler took Xms in timer.js:67

In my most recent test it was 24046ms (24s) after leaving it locked for about 60 hours.

The location that it reports is in the wake() function on line 67 of timer.js.

Based looking at what wake() does, the implication is that there's a very large number of time tasks being iterated over when the application is being woken up or it's doing some other operation to "catch up". I'm going to try to add some more instrumentation to see more precisely where the time is going, curious if this is a known issue and if there's a workaround.

Dominant language
JavaScript
Stars
168
Forks
43
Avg merge
2h 14m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from d3/d3-timer

All issues in d3/d3-timer

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.