Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 0b589ff5c2f2066348731a0f48c271c63dd43ad7 https://github.com/WebKit/WebKit/commit/0b589ff5c2f2066348731a0f48c271c63dd43ad7 Author: Ben Nham <n...@apple.com> Date: 2025-03-23 (Sun, 23 Mar 2025)
Changed paths: M Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp M Source/WebKit/NetworkProcess/cache/NetworkCacheData.h M Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h Log Message: ----------- Stop using IOChannel in NetworkCache https://bugs.webkit.org/show_bug.cgi?id=290211 rdar://142645876 Reviewed by Per Arne Vollan. This is a speculative fix for a hard-to-repro issue where page loads sometimes hang for minutes while the system is under heavy load. What we see in logs is that the disk network cache lookup ends up on a pri 4 default overcommit dispatch queue. That thread is parked in a pread and gets preempted for minutes while other higher pri work is occurring. The thing that is enqueuing the pread on to that dispatch queue is `dispatch_io_read`, which enqueues that block on to a queue that it controls. We think that probably something is going wrong with the priority propagation to that queue sometimes, as the network cache lookup hops from main thread => network cache I/O queue => dispatch_io private queue and back. As a speculative fix: - Stop using `dispatch_io` / `IOChannel` altogether. It buys us nothing other than adding extra thread hops, making things harder to debug, and perhaps exposing some latent bug in priority propagation. Instead, just do the I/O directly on the network cache's I/O queues. - Change the priority of the read-only I/O queue from default to UserInteractive, since it's on the blocking path for resource fetching. - Change the priority of the write I/O queues from Background to Utility, since Background is very punitive (capped at max pri 4), and if we get anything wrong, getting capped at max pri 4 can cause minutes of starvation. WriteOperations also had an completion handler that received an integer errno as an argument. This was unused, so I removed it. * Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp: (WebKit::NetworkCache::Data::Data): * Source/WebKit/NetworkProcess/cache/NetworkCacheData.h: * Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm: (WebKit::NetworkCache::Data::Data): * Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::WriteOperation::WriteOperation): (WebKit::NetworkCache::Storage::WriteOperation::~WriteOperation): (WebKit::NetworkCache::Storage::Storage): (WebKit::NetworkCache::Storage::dispatchReadOperation): (WebKit::NetworkCache::Storage::readRecordFromData): (WebKit::NetworkCache::Storage::dispatchWriteOperation): (WebKit::NetworkCache::Storage::finishWriteOperationActivity): (WebKit::NetworkCache::Storage::store): (WebKit::NetworkCache::Storage::WriteOperation::invokeCompletionHandler): Deleted. * Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h: (WebKit::NetworkCache::Storage::store): Deleted. Canonical link: https://commits.webkit.org/292576@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes