Bug 256200

Summary: [Win] StreamServerConnection is leaking Connection in GPU process
Product: WebKit Reporter: Fujii Hironori <fujii.hironori>
Component: WebKit2Assignee: Fujii Hironori <fujii.hironori>
Status: RESOLVED FIXED    
Severity: Normal CC: kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
connection-leak-debug-logging.patch
none
Adding Sleep
none
WIP patch none

Fujii Hironori
Reported 2023-05-02 00:23:05 PDT
[Win] StreamServerConnection is leaking Connection in GPU process 1. Apply he debug logging patch and build WinCairo Debug 2. Start WinCairo MiniBrowser in a debugger 3. Go to https://get.webgl.org/ 4. Click reload button several times Actual: The number of Connection objects in GPU process is gradually increasing. Expected: The number of Connection objects in GPU process shouldn't gradually increasing.
Attachments
connection-leak-debug-logging.patch (1.15 KB, patch)
2023-05-02 00:23 PDT, Fujii Hironori
no flags
Adding Sleep (1.54 KB, patch)
2023-05-02 01:11 PDT, Fujii Hironori
no flags
WIP patch (1.86 KB, patch)
2023-05-07 17:57 PDT, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2023-05-02 00:23:38 PDT
Created attachment 466169 [details] connection-leak-debug-logging.patch
Fujii Hironori
Comment 2 2023-05-02 01:11:50 PDT
Created attachment 466170 [details] Adding Sleep Adding Sleep() in Connection::dispatchDidCloseAndInvalidate works around the problem.
Fujii Hironori
Comment 3 2023-05-07 17:57:52 PDT
Created attachment 466267 [details] WIP patch Connection::dispatchDidCloseAndInvalidate is using Connection::dispatchToClient. However, Connection::dispatchToClient doesn't work in the RemoteGraphicsContextGL work queue because the thread isn't using RunLoop. This problem can be fixed by using RunLoop::main() instead of using RunLoop::current() in the RemoteGraphicsContextGL work queue.
Fujii Hironori
Comment 4 2023-05-07 17:59:57 PDT
But, this patch introduces a new assertion failure for comment#0's steps. ASSERTION FAILED: this == &current() C:\home\webkit\gb\Source\WTF\wtf\RunLoop.cpp(209) : WTF::RunLoop::assertIsCurrent 1 00007FFEB60B26FB WTFCrash 2 00007FFEB60B77FD WTFCrashWithInfo 3 00007FFEB615C73D WTF::RunLoop::assertIsCurrent 4 00007FFE78E0D6EA WTF::assertIsCurrent 5 00007FFE78DF1B1F IPC::Connection::dispatcher 6 00007FFE78DEC3C8 IPC::Connection::invalidate 7 00007FFE78E31FE3 IPC::StreamServerConnection::invalidate 8 00007FFE788EF905 WebKit::RemoteGraphicsContextGL::workQueueUninitialize 9 00007FFE788F10AF `WebKit::RemoteGraphicsContextGL::stopListeningForIPC'::`2'::<lambda_1>::operator() 10 00007FFE788F288B WTF::Detail::CallableWrapper<`WebKit::RemoteGraphicsContextGL::stopListeningForIPC'::`2'::<lambda_1>,void>::call 11 00007FFE77E0D554 WTF::Function<void __cdecl(void)>::operator() 12 00007FFE78E33C08 IPC::StreamConnectionWorkQueue::processStreams 13 00007FFE78E33E95 `IPC::StreamConnectionWorkQueue::startProcessingThread'::`2'::<lambda_1>::operator() 14 00007FFE78E343CB WTF::Detail::CallableWrapper<`IPC::StreamConnectionWorkQueue::startProcessingThread'::`2'::<lambda_1>,void>::call 15 00007FFEB60C9D93 WTF::Function<void __cdecl(void)>::operator() 16 00007FFEB616B558 WTF::Thread::entryPoint 17 00007FFEB6244BC4 WTF::wtfThreadEntryPoint 18 00007FFF6B761BB2 configthreadlocale 19 00007FFF6D4B7604 BaseThreadInitThunk 20 00007FFF6D9226A1 RtlUserThreadStart
Fujii Hironori
Comment 5 2023-05-07 18:06:03 PDT
Adding Sleep() works around the leakage problem (comment#2). Connection::invalidate is called in the other thread during the sleep. Connection::dispatchToClient does nothing after invalidated.
Fujii Hironori
Comment 6 2023-05-07 22:11:28 PDT
Radar WebKit Bug Importer
Comment 7 2023-05-09 00:24:21 PDT
Fujii Hironori
Comment 8 2023-05-24 12:45:31 PDT
264465@main (bug#249769) fixed the problem.
Note You need to log in before you can comment on or make changes to this bug.