Resource leak in Linux/BlueZ
Problem
In src/platform/Linux/bluez/MainLoop.cpp,
chip::Device::Internal::MainLoop::EnsureStarted() spawns a thread which is never joined or cleaned up after.
int pthreadErr = pthread_create(&mThread, nullptr, &MainLoop::Thread, reinterpret_cast<void *>(this));
Proposed Solution
pthread_join() for mThread needs to be called at an appropriate place to wait for the thread to terminate. Since pthread_create is called with null attr, the thread is in joinable state.
@msandstedt @z-michel
@samadDotDev it looks like this is still an issue - can you confirm? Do you know who to assign it to?
@holbrookt Yes, the latest master still has mThread in joinable state but is never joined.
Given this is a linux platform example issue, can be resolved post v1.0
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This stale issue has been automatically closed. Thank you for your contributions.
Still an issue. But as @woody-apple, can be post-1.0.
This stale issue has been automatically closed. Thank you for your contributions.
Fixed by https://github.com/project-chip/connectedhomeip/pull/23320.