WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
152416
Web Inspector: WebInspector.dispatchNextQueuedMessageFromBackend leaks
https://bugs.webkit.org/show_bug.cgi?id=152416
Summary
Web Inspector: WebInspector.dispatchNextQueuedMessageFromBackend leaks
Nikita Vasilyev
Reported
2015-12-17 20:36:16 PST
Run the following HTML for 1 minute: <script> setInterval(function() { console.info(Math.random()) }, 1); </script> After 1 minute, Web Inspector becomes unresponsive, even when the console tab was never opened.
https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Protocol/MessageDispatcher.js#L29
I added the following code at the bottom of dispatchNextQueuedMessageFromBackend: console.info(i, WebInspector._messagesToDispatch.length - 1) I showed: 4 145 4 141 4 137 4 260 4 256 4 252 ... After a minute: 3 6855 3 6852 3 6892 3 6920 3 6917 3 6951 3 6976 ... And another minute: 3 22495 3 22589 3 22684 2 22803 3 22907 ... WebInspector.dispatchNextQueuedMessageFromBackend isn't keeping up with the influx of messages. It processes messages at a slower pace than they are being added, making Web Inspector UI unresponsive. It is possible that on a fast machine such as Mac Pro this leak wouldn't even happen. On a slow machine this leaks very fast.
Attachments
Add attachment
proposed patch, testcase, etc.
Nikita Vasilyev
Comment 1
2015-12-17 20:43:53 PST
If WebKit implements requestIdleCallback we should consider using it.
https://developers.google.com/web/updates/2015/08/using-requestidlecallback?hl=en
Request to implement:
https://lists.webkit.org/pipermail/webkit-dev/2015-September/027656.html
Blaze Burg
Comment 2
2015-12-18 13:10:58 PST
(In reply to
comment #0
)
> Run the following HTML for 1 minute: > > <script> > setInterval(function() { > console.info(Math.random()) > }, 1); > </script> > > After 1 minute, Web Inspector becomes unresponsive, even when the console > tab was never opened.
>
>
https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/
> UserInterface/Protocol/MessageDispatcher.js#L29 > > I added the following code at the bottom of > dispatchNextQueuedMessageFromBackend: > > console.info(i, WebInspector._messagesToDispatch.length - 1) > > I showed: > > 4 145 > 4 141 > 4 137 > 4 260 > 4 256 > 4 252 > ... > > After a minute: > > 3 6855 > 3 6852 > 3 6892 > 3 6920 > 3 6917 > 3 6951 > 3 6976 > ... > > And another minute: > > 3 22495 > 3 22589 > 3 22684 > 2 22803 > 3 22907 > ... > > WebInspector.dispatchNextQueuedMessageFromBackend isn't keeping up with the > influx of messages. > It processes messages at a slower pace than they are being added, making Web > Inspector UI unresponsive. >
I don't think there's anything wrong with WebInspector.dispatchNextQueuedMessageFromBackend. It's not leaking any memory. If backend messages were to stop, it would eventually drain the message queue. The problem is that the console code is extremely intertwined with the DOM, so it takes (relatively) forever to process a console log message. There is nothing that this code could do differently to fix the problem (without introducing bigger problems).
> It is possible that on a fast machine such as Mac Pro this leak wouldn't > even happen. > On a slow machine this leaks very fast.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug