| Summary: | Crash under GPUProcessProxy::getGPUProcessConnection() | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Said Abou-Hallawa <sabouhallawa> | ||||||||||||||||||
| Component: | Canvas | Assignee: | Chris Dumez <cdumez> | ||||||||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||||||||
| Severity: | Normal | CC: | achristensen, cdumez, darin, dino, ggaren, simon.fraser, webkit-bug-importer | ||||||||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||||||||
| Hardware: | Unspecified | ||||||||||||||||||||
| OS: | Unspecified | ||||||||||||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=225486 | ||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||
|
Description
Said Abou-Hallawa
2021-03-31 14:12:51 PDT
Created attachment 424823 [details]
Patch
Comment on attachment 424823 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=424823&action=review > Source/WebKit/UIProcess/WebProcessPool.cpp:365 > + if (m_gpuProcess) > + m_gpuProcess->shutDownProcess(); I was wrong about this change. The life cycle of m_gpuProcess is different from the WebProcesses which are owned by the WebProcessPool. I made this assertion in this code #if ENABLE(GPU_PROCESS) if (m_gpuProcess) { ASSERT(m_gpuProcess->hasOneRef()); m_gpuProcess->shutDownProcess(); } #endif And I ran the canvas layout tests and this assertion fires multiple times. I think the assertion fires because there is a singleton GPU Process for all the WebProcesses. If there are multiple WebProcessPools, i.e. WebProcessPool::allProcessPools() has more than one item, m_gpuProcess will only be destroyed when the last WebProcessPool is destroyed. Created attachment 424859 [details]
Patch
Committed r275349: <https://commits.webkit.org/r275349> All reviewed patches have been landed. Closing bug and clearing flags on attachment 424859 [details]. r275349 does not guarantee all the pending messages of GPUProcessProxy will be processed before starting the deletion of WebProcessPool. Some messages may be processed inside the AuxiliaryProcessProxy destructor. Created attachment 427210 [details]
Patch
Comment on attachment 427210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427210&action=review > Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:199 > + replyToPendingMessages(); ~AuxiliaryProcessProxy() already does that. So why does ~GPUProcessProxy() need to do it too? > Source/WebKit/UIProcess/WebProcessPool.cpp:364 > + // Force calling the destrsuctor of GPUProcessProxy to ensure the completion typo: destrsuctor Comment on attachment 427210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427210&action=review > Source/WebKit/UIProcess/WebProcessPool.cpp:366 > + m_gpuProcess = nullptr; Note that this does not necessarily destroy the GPUProcessProxy since a single GPUProcessProxy may be shared by several WebProcessPool objects. Comment on attachment 427210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427210&action=review > Source/WebKit/UIProcess/WebProcessPool.cpp:-364 > - if (m_gpuProcess) Note that this previous code was wrong too since a GPUProcessProxy can be shared by several process pool. Having a single WebProcessPool getting destroyed should not cause pending messages from other process pool to get replied to eagerly. Comment on attachment 427210 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427210&action=review >> Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:199 >> + replyToPendingMessages(); > > ~AuxiliaryProcessProxy() already does that. So why does ~GPUProcessProxy() need to do it too? See the completion handler in GPUProcessProxy::getGPUProcessConnection(). We capture this as a WeakPtr and if we reply the pending messages from ~AuxiliaryProcessProxy(), GPUProcessProxy will be invalid and a call like this->connection() will crash. >> Source/WebKit/UIProcess/WebProcessPool.cpp:366 >> + m_gpuProcess = nullptr; > > Note that this does not necessarily destroy the GPUProcessProxy since a single GPUProcessProxy may be shared by several WebProcessPool objects. So this may not be needed then. Comment on attachment 427210 [details]
Patch
I think the safest fix here is to protect the WebProcessPool in the lambda in WebProcessPool::getGPUProcessConnection(), instead of using a WeakPtr.
Created attachment 427217 [details]
Patch
Created attachment 427225 [details]
Patch
Created attachment 427227 [details]
Patch
Created attachment 427231 [details]
Patch
Created attachment 427232 [details]
Patch
Committed r276712 (237117@main): <https://commits.webkit.org/237117@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 427232 [details]. |