Bug 231418

Summary: Clearly distinguish serial from concurrent WorkQueue
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: PlatformAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cgarcia, cmarcelo, dino, eric.carlson, ews-watchlist, glenn, hta, jer.noble, keith_miller, kondapallykalyan, mark.lam, msaboff, philipj, saam, sergio, tommyw, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=231472
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Jean-Yves Avenard [:jya]
Reported 2021-10-08 03:54:42 PDT
Currently we have a unique WorkQueue object, which can be configured at construction time to be either a concurrent or a serial one. A concurrent WorkQueue doesn't guarantee the order in which the queued tasks will run. That makes for a footgun if a consumer takes a WorkQueue and is expecting it to be a serial one. We should split the WorkQueue into a ConcurrentWorkQueue object, and make WorkQueue be a serial one.
Attachments
Patch (46.08 KB, patch)
2021-10-09 00:48 PDT, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Patch (47.78 KB, patch)
2021-10-09 02:08 PDT, Jean-Yves Avenard [:jya]
ews-feeder: commit-queue-
Patch (47.82 KB, patch)
2021-10-09 02:40 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (47.95 KB, patch)
2021-10-09 05:08 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (47.96 KB, patch)
2021-10-09 05:47 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (49.57 KB, patch)
2021-10-12 00:58 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (49.44 KB, patch)
2021-10-12 16:04 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (49.33 KB, patch)
2021-10-13 15:20 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (48.06 KB, patch)
2021-10-13 15:46 PDT, Jean-Yves Avenard [:jya]
no flags
Radar WebKit Bug Importer
Comment 1 2021-10-08 03:55:03 PDT
Jean-Yves Avenard [:jya]
Comment 2 2021-10-09 00:48:02 PDT
Jean-Yves Avenard [:jya]
Comment 3 2021-10-09 02:08:22 PDT
Jean-Yves Avenard [:jya]
Comment 4 2021-10-09 02:40:31 PDT
Jean-Yves Avenard [:jya]
Comment 5 2021-10-09 05:08:16 PDT
Jean-Yves Avenard [:jya]
Comment 6 2021-10-09 05:47:46 PDT
Jean-Yves Avenard [:jya]
Comment 7 2021-10-12 00:58:28 PDT
Chris Dumez
Comment 8 2021-10-12 09:56:07 PDT
Comment on attachment 440905 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440905&action=review EWS is red. > Source/WTF/wtf/WorkQueue.h:59 > + enum class Type { : bool > Source/WTF/wtf/WorkQueue.h:63 > + static Ref<WorkQueueBase> create(const char* name, Type, QOS); Why is this factory function still here? We shouldn't need it. > Source/WTF/wtf/WorkQueue.h:87 > +class WorkQueue : public WorkQueueBase { Should be marked as final. > Source/WTF/wtf/WorkQueue.h:97 > +protected: Why protected? Seems the constructor should be private. Are there any subclasses of WorkQueue? > Source/WTF/wtf/WorkQueue.h:115 > +class ConcurrentWorkQueue : public WorkQueueBase { final
Jean-Yves Avenard [:jya]
Comment 9 2021-10-12 14:39:47 PDT
Comment on attachment 440905 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=440905&action=review >> Source/WTF/wtf/WorkQueue.h:59 >> + enum class Type { > > : bool when it's existing code like this being moved, I typically keep it as-is. >> Source/WTF/wtf/WorkQueue.h:87 >> +class WorkQueue : public WorkQueueBase { > > Should be marked as final. There's SuspendableWorkQueue ; this class and how the IOCache works is the primary reason I went with WebKitBase over the templated version we talked about. I believe it's WorkQueue people should be inheriting from rather than WorkQueueBase. >> Source/WTF/wtf/WorkQueue.h:97 >> +protected: > > Why protected? Seems the constructor should be private. Are there any subclasses of WorkQueue? yes SuspendableWorkQueue
Chris Dumez
Comment 10 2021-10-12 14:41:27 PDT
(In reply to Jean-Yves Avenard [:jya] from comment #9) > Comment on attachment 440905 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=440905&action=review > > >> Source/WTF/wtf/WorkQueue.h:59 > >> + enum class Type { > > > > : bool > > when it's existing code like this being moved, I typically keep it as-is. Not the WebKit policy though. In WebKit we clean up as we modify existing code since we rarely do pure clean up commits. > > >> Source/WTF/wtf/WorkQueue.h:87 > >> +class WorkQueue : public WorkQueueBase { > > > > Should be marked as final. > > There's SuspendableWorkQueue ; this class and how the IOCache works is the > primary reason I went with WebKitBase over the templated version we talked > about. > > I believe it's WorkQueue people should be inheriting from rather than > WorkQueueBase. > > >> Source/WTF/wtf/WorkQueue.h:97 > >> +protected: > > > > Why protected? Seems the constructor should be private. Are there any subclasses of WorkQueue? > > yes SuspendableWorkQueue
Jean-Yves Avenard [:jya]
Comment 11 2021-10-12 16:04:56 PDT
Created attachment 441010 [details] Patch rebase, apply comments
Chris Dumez
Comment 12 2021-10-13 10:05:04 PDT
Comment on attachment 441010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441010&action=review > Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannel.h:53 > + // For safety, it should use a serial WorkQueue (see https://bugs.webkit.org/show_bug.cgi?id=231472) I still don't understand this comment and I don't think it is accurate. Cocoa uses a concurrent WorkQueue and the code is safe.
Jean-Yves Avenard [:jya]
Comment 13 2021-10-13 14:00:34 PDT
Comment on attachment 441010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441010&action=review >> Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannel.h:53 >> + // For safety, it should use a serial WorkQueue (see https://bugs.webkit.org/show_bug.cgi?id=231472) > > I still don't understand this comment and I don't think it is accurate. Cocoa uses a concurrent WorkQueue and the code is safe. Yes, this comment is incorrect. Forgot to remove it
Chris Dumez
Comment 14 2021-10-13 14:01:09 PDT
Comment on attachment 441010 [details] Patch Ok, r=me but please drop the comment.
Chris Dumez
Comment 15 2021-10-13 14:01:35 PDT
Comment on attachment 441010 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=441010&action=review > Source/JavaScriptCore/ChangeLog:11 > + Reviewed by NOBODY (OOPS!). This is supposed to be above the description, not under. > Source/WTF/ChangeLog:19 > + Reviewed by NOBODY (OOPS!). This is supposed to be above the description, not under.
Jean-Yves Avenard [:jya]
Comment 16 2021-10-13 15:20:42 PDT
Jean-Yves Avenard [:jya]
Comment 17 2021-10-13 15:33:28 PDT
grrr another rebasing issue
Jean-Yves Avenard [:jya]
Comment 18 2021-10-13 15:46:58 PDT
Created attachment 441151 [details] Patch rebase
EWS
Comment 19 2021-10-13 17:09:25 PDT
Committed r284135 (242955@main): <https://commits.webkit.org/242955@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 441151 [details].
Yusuke Suzuki
Comment 20 2021-10-13 17:39:29 PDT
Note You need to log in before you can comment on or make changes to this bug.