Bug 222279 - Make system console logging synchronous
Summary: Make system console logging synchronous
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alicia Boya García
URL:
Keywords: InRadar
Depends on: 227080
Blocks:
  Show dependency treegraph
 
Reported: 2021-02-22 11:07 PST by Alicia Boya García
Modified: 2021-06-16 11:34 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.30 KB, patch)
2021-02-22 11:11 PST, Alicia Boya García
no flags Details | Formatted Diff | Diff
Patch (5.26 KB, patch)
2021-02-23 02:21 PST, Alicia Boya García
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alicia Boya García 2021-02-22 11:07:33 PST
Previously, the logging of messages to the system console was done in
PageConsoleClient::addMessage(), which was called by
Document::addConsoleMessage(). The latter was called in a TaskQueue
callback.

This had the unfortunate side effect of adding a delay from the time a
macro such as ALWAYS_LOG() is called and the text being printed to the
console. This is particularly a problem when logging 3rd party
libraries that don't use the WebKit logging API to log to stderr, such
as GStreamer, since it causes messages logged by WebKit to not be
synchronized with messages logged by 3rd party libraries or logging
systems. As a consequence the usefulness of WebKit logs is noticeably
reduced.

This patch fixes the issue by moving the code logging to the system
console to the synchronous part of Document::didLogMessage(), while
still handling the rest in the m_logMessageTaskQueue callback.
Comment 1 Alicia Boya García 2021-02-22 11:11:39 PST
Created attachment 421214 [details]
Patch
Comment 2 Alicia Boya García 2021-02-23 02:21:35 PST
Created attachment 421294 [details]
Patch
Comment 3 EWS 2021-02-23 12:10:01 PST
Committed r273329: <https://commits.webkit.org/r273329>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421294 [details].
Comment 4 Radar WebKit Bug Importer 2021-02-23 12:11:13 PST
<rdar://problem/74654614>
Comment 5 Timothy Hatcher 2021-06-16 10:06:19 PDT
This change broke logging most errors like CSP and promise rejections to the system console. Those do not go through Document::didLogMessage(), they call Document::addConsoleMessage() directly.
Comment 6 Timothy Hatcher 2021-06-16 10:35:23 PDT Comment hidden (obsolete)
Comment 7 Timothy Hatcher 2021-06-16 10:36:55 PDT
Re-opened since this is blocked by bug 227080.
Comment 8 Alicia Boya García 2021-06-16 11:34:23 PDT
Can reproduce. Will investigate.