Opened 20 months ago
Closed 2 weeks ago
#18529 closed bug (fixed)
WebSocket thread sometimes pegging a core on GitHub
Reported by: | humdinger | Owned by: | pulkomandy |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta6 |
Component: | Kits/Web Kit | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
This is on HaikuWebKit 1.9.6, WebKit 616.1.22
Sometimes when going to a GitHub repo a "WebSocket thread" pegs a CPU core. Unfortunately, it's not relyably reproducible (or 'luckily', when you actually want to use the site without the CPU fan blasting...).
I did save a debug report of the pegging "WebSocket thread" (attached), if that is of any help. It starts with:
thread 6923: WebSocket thread state: Debugged Frame IP Function Name ----------------------------------------------- 00000000 0x1735b53a78a _kern_poll + 0xa Disassembly: _kern_poll: 0x000001735b53a780: 4989ca mov %rcx, %r10 0x000001735b53a783: 48c7c080000000 mov $0x80, %rax 0x000001735b53a78a: 0f05 syscall <-- 0x7f57519b90d0 0x1735b543af5 poll + 0x15 0x7f57519b9110 0x1bf2a130eaf BAbstractSocket::_WaitFor(int, long) const + 0x6f 0x7f57519b9230 0x12e4629eac7 WebCore::SocketStreamHandleImpl::threadEntryPoint() + 0x1a7 0x7f57519b9260 0x12e482a89fc WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 0x5c 0x7f57519b9270 0x12e48314784 _ZN3WTFL19wtfThreadEntryPointEPv + 0x4 0x7f57519b9290 0x1735b549155 pthread_thread_entry(void*, void*) + 0x15 00000000 0x7f1737b48258 commpage_thread_exit + 0
Attachments (2)
Change History (10)
by , 20 months ago
Attachment: | WebPositive-2163-debug-27-07-2023-07-05-31.report added |
---|
comment:1 by , 20 months ago
comment:3 by , 20 months ago
That only says:
strace: Failed to install team debugger: Operation on invalid team
The <pid> is the ID of the thread as shown in Slayer or Debugger when debugging that pegging thread, right?
comment:4 by , 20 months ago
Result: a lot of calls to poll() on fd 33, returning POLLIN|POLLERR revents.
poll([{fd=33, events=POLLIN}], 0x1, 0x4e20, (nil)) = 0x1 ([{fd=33, revents=POLLIN|POLLERR}])
comment:5 by , 20 months ago
Aha the <pid> is the team ID of WebPositive, not the pegging thread ID. I've attached a short strace capture.
comment:6 by , 20 months ago
I guess this method is called from WaitForReadable. Where will the socket error be detected and cleared? Because if it isn't, then this will indeed just loop forever.
comment:7 by , 20 months ago
The logic in WebKit is here: https://github.com/haiku/haikuwebkit/blob/haiku/Source/WebKitLegacy/haiku/WebCoreSupport/SocketStreamHandleHaiku.cpp#L128
Since this is a Haiku-specific implementation, maybe there's some mechanism for detecting when we are supposed to terminate the loop which this missed in the WebKit upgrades?
comment:8 by , 2 weeks ago
Milestone: | Unscheduled → R1/beta6 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Should be fixed in HaikuWebKit 1.9.21. There was a missing check to exit the loop if writing to the socket returns an error.
If you can manage to reproduce this again, could you run an
strace -T <pid>
in Terminal, with the PID of the looping WebPositive process?