Bug 142602 - setInterval() creates uncontrolled CPU spike
Summary: setInterval() creates uncontrolled CPU spike
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (other bugs)
Version First Reported In: unspecified
Platform: Debian testing Linux
: NOR crash
Target Milestone: ---
Assignee: Konqueror Bugs
URL:
Keywords: efficiency-and-performance
Depends on:
Blocks:
 
Reported: 2007-03-06 15:36 UTC by stgallag
Modified: 2024-05-06 20:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Testcase that illustrates the point (667 bytes, text/html)
2007-03-06 15:39 UTC, stgallag
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stgallag 2007-03-06 15:36:31 UTC
Version:           Whatever comes with konqueror/kde 3.5.5 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

I replaced setTimeout with setInterval in a Javascript function I created. Not knowing the implications, I refreshed. But setInterval continues on it's own, not needing to be called repeatedly. However, when it is called repeatedly, the number of functions increases in a binary pattern. Even with large delays, it's only a matter of time until the CPU hits 100%. The only fix is to close/killall konqueror, which is to me, a crash.

In short, this is similar to a "while (true)", except it's a zillion functions running concurrently. Preferably, there should be a dialog just like the one for a "while (true)", where I can abort the script.

This illustrates the point:
http://clancy.homelinux.com/konqtest2.html
Comment 1 stgallag 2007-03-06 15:39:49 UTC
Created attachment 19893 [details]
Testcase that illustrates the point

This is the file found at http://clancy.homelinux.com/konqtest2.html, attached
just in case the site goes down.
Comment 2 Eduardo Robles Elvira 2008-06-06 01:01:27 UTC
Confirmed in KDE > 4.1 beta 1 (SVN trunk rev 817151). Konqueror freezes.
Comment 3 stgallag 2008-06-06 14:14:30 UTC
This also happens for Firefox and various other browsers: https://bugzilla.mozilla.org/show_bug.cgi?id=335256
Comment 4 Christoph Cullmann 2024-05-06 20:51:26 UTC
Dear user,

KHTML (and KJS) was a long time more or less unmaintained and got removed in KF6.

Please migrate to use a QWebEngine based HTML component.

We will do no further fixes or improvements to the KF5 branches of these components beside important security fixes.

For security issues, please see:

https://kde.org/info/security/

Sorry that we did not fix this issue during the life-time of KHTML.

Greetings
Christoph Cullmann