Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux platform wifiIPThread resource leak #9212

Closed
msandstedt opened this issue Aug 24, 2021 · 1 comment · Fixed by #15167
Closed

Linux platform wifiIPThread resource leak #9212

msandstedt opened this issue Aug 24, 2021 · 1 comment · Fixed by #15167
Assignees

Comments

@msandstedt
Copy link
Contributor

Problem

From this rev:

commit ab665728d96a946ef3d6e2715784b7dbc0f6a3eb
Author: Andrei Litvin <[email protected]>
Date:   Sat Aug 21 10:49:52 2021 -0400

And this file:

platform/Linux/PlatformManagerImpl.cpp

This code spawns and detaches this thread, and keeps no reference to it:

CHIP_ERROR PlatformManagerImpl::_InitChipStack()
...
    std::thread wifiIPThread(WiFIIPChangeListener);
    wifiIPThread.detach();

This is effectively a resource leak. It's impossible to cleanup this thread and, so each InitChipStack leaks another thread. This also presumably makes orderly shutdown impossible. WiFIIPChangeListener may never stop posting work to the event event queue.

Proposed Solution

  • Linux platform must retain a reference to the spawned wifiIPThread
  • Linux platform requires a symmetric _Shutdown method
  • the _Shutdown method must signal to the wifiIPThread and then join it
@msandstedt
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants