Bug 12637

Summary: Long-running regular expressions should be interruptible
Product: WebKit Reporter: David Smith <catfish.man>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: barraclough
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: http://www.dscoder.com/regex.html

David Smith
Reported 2007-02-06 13:03:24 PST
Regular expressions can take arbitrarily long to match, but cannot currently be interrupted. This can lead to hangs of arbitrary length, which is probably a bad thing. The test URL will cause a fairly long pause (in the Feb. 5th nightly build), but it will eventually recover.
Attachments
David Smith
Comment 1 2007-02-28 22:29:51 PST
This is no longer nearly as serious after some regex speedups shortly after the nightly I tested with. It still causes very high cpu usage and pauses, but it doesn't freeze the browser for more than a second or so on my Core 2 Duo 2GHz machine, and the freeze time is bounded (i.e. increasing the regex size beyond a certain point doesn't increase the time).
Gavin Barraclough
Comment 2 2012-09-23 15:32:29 PDT
The old timeout mechanism has now been deprecated, and this is handled by webkit2 - if a script runs for too long, the browser can just shoot down the webprocess.
Note You need to log in before you can comment on or make changes to this bug.