Skip to content

Thread leak during clean up #165

Description

@aazamansari

We have browser working as service in our system. We are using westeros backend.
We create WKContext, WKView runtime as request to load page comes.
Once request is done we delete the WKContext and WKView and release the resources.

What we observe is that there is thread leak happening for "ReceiveQueue" threads.
These ReceiveQueue threads are created by IPC::Connection through WorkQueue.

Source/WebKit2/Platform/IPC/Connection.cpp
When releasing the resources, the 2 ReceiveQueue threads are going in deadlock state.

WorkQueue destructor ~WorkQueue() is getting called in the same thread.
It is calling WorkQueue::platformInvalidate() which calls wait as below.
m_terminateRunLoopCondition.wait(m_terminateRunLoopConditionMutex);

This condition is notified by the same thread and hence the thread goes in deadlock state.

Below link provides the backtrace of the stack that we see for the deadlocked threads.
Out of these top 6 threads have leaked.
https://gist.github.com/aazamansari/40494a4036aeebfacd0c25a106b22229

Below is an example code of how we load the page and then cleanup the resources.
https://gist.github.com/aazamansari/f64b3d8db8f89c51097c83899961a36b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions