RESOLVED FIXED 236844
Add assertion that no two sessions share the same general storage directory
https://bugs.webkit.org/show_bug.cgi?id=236844
Summary Add assertion that no two sessions share the same general storage directory
Sihui Liu
Reported 2022-02-18 09:54:17 PST
...
Attachments
Patch (4.75 KB, patch)
2022-02-18 10:34 PST, Sihui Liu
no flags
Patch (5.96 KB, patch)
2022-02-18 15:12 PST, Sihui Liu
no flags
Patch for landing (5.93 KB, patch)
2022-02-18 16:54 PST, Sihui Liu
no flags
Patch (5.46 KB, patch)
2022-02-28 15:40 PST, Sihui Liu
no flags
Patch (5.51 KB, patch)
2022-02-28 16:05 PST, Sihui Liu
no flags
Patch (23.25 KB, patch)
2022-03-01 19:27 PST, Sihui Liu
no flags
Patch (23.23 KB, patch)
2022-03-01 23:16 PST, Sihui Liu
no flags
Patch for landing (23.18 KB, patch)
2022-03-02 09:47 PST, Sihui Liu
no flags
Sihui Liu
Comment 1 2022-02-18 10:34:57 PST
Sihui Liu
Comment 2 2022-02-18 15:12:14 PST
Chris Dumez
Comment 3 2022-02-18 16:46:09 PST
Comment on attachment 452586 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452586&action=review r=me > Source/WebKit/ChangeLog:3 > + Add assertion that no two network session share the same storage path sessions (plural) > Source/WebKit/ChangeLog:8 > + Each NetworkStorageManager has its own queue and access the storage files on that queue, so we can't have two accesses > Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:115 > + static NeverDestroyed<HashSet<String>> paths; I just learned today that you can use MainThreadNeverDestroyed (and drop your main thread assertion above).
Sihui Liu
Comment 4 2022-02-18 16:54:06 PST
Created attachment 452609 [details] Patch for landing
EWS
Comment 5 2022-02-18 20:15:19 PST
Committed r290196 (247524@main): <https://commits.webkit.org/247524@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452609 [details].
Radar WebKit Bug Importer
Comment 6 2022-02-18 20:16:17 PST
Chris Dumez
Comment 7 2022-02-19 13:43:01 PST
Reverted r290196 for reason: Caused Network Process crashes <rdar://89190571> Committed r290214 (247542@trunk): <https://commits.webkit.org/247542@trunk>
Sihui Liu
Comment 8 2022-02-28 15:40:09 PST
Chris Dumez
Comment 9 2022-02-28 15:50:04 PST
Comment on attachment 453443 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=453443&action=review > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:211 > + HashMap<String, PAL::SessionID> directoriesBySession; This name seems wrong. If something says "BySession", then I'd expect the session to be the HashMap key, not the value. Maybe this could be named something like: "directorySessions" or "sessionForDirectory" > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:216 > + RELEASE_ASSERT_WITH_MESSAGE(directoriesBySession.add(directory, sessionID).isNewEntry, "GeneralStorageDirectory for session '%llu' is already in use by session '%llu'", directoriesBySession.get(directory).toUInt64(), sessionID.toUInt64()); We're supposed to use PRIu64, not %llu to print 64bit integers to be friendly to Linux ports. Looks like this code may not build on Linux but I think it I still good practice.
Sihui Liu
Comment 10 2022-02-28 16:05:27 PST
Sihui Liu
Comment 11 2022-02-28 16:06:19 PST
(In reply to Chris Dumez from comment #9) > Comment on attachment 453443 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453443&action=review > > > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:211 > > + HashMap<String, PAL::SessionID> directoriesBySession; > > This name seems wrong. If something says "BySession", then I'd expect the > session to be the HashMap key, not the value. > Maybe this could be named something like: "directorySessions" or > "sessionForDirectory" Changed to sessionForDirectory. > > > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:216 > > + RELEASE_ASSERT_WITH_MESSAGE(directoriesBySession.add(directory, sessionID).isNewEntry, "GeneralStorageDirectory for session '%llu' is already in use by session '%llu'", directoriesBySession.get(directory).toUInt64(), sessionID.toUInt64()); > > We're supposed to use PRIu64, not %llu to print 64bit integers to be > friendly to Linux ports. Looks like this code may not build on Linux but I > think it I still good practice. Sure, changed to PRIu64.
Sihui Liu
Comment 12 2022-03-01 19:27:27 PST
Sihui Liu
Comment 13 2022-03-01 23:16:12 PST
EWS
Comment 14 2022-03-02 09:42:19 PST
ChangeLog entry in Tools/ChangeLog contains OOPS!.
Sihui Liu
Comment 15 2022-03-02 09:47:28 PST
Created attachment 453627 [details] Patch for landing
EWS
Comment 16 2022-03-02 11:01:18 PST
Committed r290739 (247985@main): <https://commits.webkit.org/247985@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453627 [details].
Note You need to log in before you can comment on or make changes to this bug.