NEW 288760
[Cocoa] Assertion failure on ResourceUsageThread::platformCollectCPUData()
https://bugs.webkit.org/show_bug.cgi?id=288760
Summary [Cocoa] Assertion failure on ResourceUsageThread::platformCollectCPUData()
Basuke Suzuki
Reported 2025-02-27 14:37:39 PST
In Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm:163, comment and ASSERT say threads[0] must be main thread, but it seems like it's not. ``` // Main thread is always first. ASSERT(threads[0].dispatchQueueName == "com.apple.main-thread"_s); ```
Attachments
Basuke Suzuki
Comment 1 2025-02-27 15:01:12 PST
Vector<ThreadInfo> threads at the moment is like this. Apparently first item is not "com.apple.main-thread"_s. Of course the first thread in the actual running thread list is main thread, so this seems like collection failure. Somewhat error may happens to prevent collecting main thread information during the for look in static Vector<ThreadInfo> threadInfos(). ``` threads WTF::Vector<WebCore::ThreadInfo> { size = 25, capacity = 27 } [0] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 92.0999985 threadName WTF::String { length = 0, contents = '' } dispatchQueueName WTF::String { length = 35, contents = 'com.apple.root.user-interactive-qos' } [1] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 5.29999971 threadName WTF::String { length = 0, contents = '' } dispatchQueueName WTF::String { length = 23, contents = 'org.webkit.ImageDecoder' } [2] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0.100000001 threadName WTF::String { length = 31, contents = 'JavaScriptCore libpas scavenger' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [3] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 0, contents = '' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [4] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 4 threadName WTF::String { length = 22, contents = 'WebCore: ResourceUsage' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [5] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 15.6000004 threadName WTF::String { length = 26, contents = 'JIT Worklist Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [6] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 7.50000048 threadName WTF::String { length = 26, contents = 'JIT Worklist Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [7] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 4.4000001 threadName WTF::String { length = 26, contents = 'JIT Worklist Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [8] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 0, contents = '' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [9] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 18, contents = 'Heap Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [10] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 18, contents = 'Heap Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [11] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 18, contents = 'Heap Helper Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [12] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 0, contents = '' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } [13] WebCore::ThreadInfo sendRight WTF::MachSendRight usage float 0 threadName WTF::String { length = 25, contents = 'JSC Heap Collector Thread' } dispatchQueueName WTF::String { length = 37, contents = 'com.apple.root.default-qos.overcommit' } ... ```
Basuke Suzuki
Comment 2 2025-02-27 15:03:45 PST
I'm not sure we can move forward without getting main_thread, so I change this assertion to early return.
Basuke Suzuki
Comment 3 2025-02-27 15:29:22 PST
Basuke Suzuki
Comment 4 2025-02-28 13:01:59 PST
How to reproduce: 1. Start debugging MiniBrowser in Xcode 2. Go to https://www.yahoo.com/ 3. Keep scrolling for a while. Debugger stops with the assertion failure in `WebCore: ResourceUsage` thread.
Basuke Suzuki
Comment 5 2025-02-28 13:07:57 PST
I believe Web Inspector should be opened.
Radar WebKit Bug Importer
Comment 6 2025-03-06 14:38:14 PST
Note You need to log in before you can comment on or make changes to this bug.