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

Possible use of destroyed pool objects #11880

Closed
kpschoedel opened this issue Nov 16, 2021 · 2 comments · Fixed by #12499
Closed

Possible use of destroyed pool objects #11880

kpschoedel opened this issue Nov 16, 2021 · 2 comments · Fixed by #12499
Assignees

Comments

@kpschoedel
Copy link
Contributor

kpschoedel commented Nov 16, 2021

Problem

Historically, objects allocated from a pool have not been destroyed or flagged when the pool is destroyed. https://github.com/project-chip/connectedhomeip/runs/4228395289 appears be failing due to an object (TCPEndPoint) outliving its pool.

@kpschoedel kpschoedel self-assigned this Nov 16, 2021
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 18, 2021
#### Problem

`chip::Server::Shutdown()` contains

```
chip::Dnssd::ServiceAdvertiser::Instance().Shutdown();
    ⋮
mCommissioningWindowManager.Cleanup();
```

but the latter restarts `Dnssd::ServiceAdvertiser`.

Instance of project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

Add `CommissioningWindowManager::Shutdown()` which does not restart DNS.

#### Testing

If `ObjectPool` checks that objects do not outlive it
(originally part of PR project-chip#11698 but deferred due to current leaks),
then `TestCommissionManager` fails without this change.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 18, 2021
#### Problem

`chip::Server::Shutdown()` contains

```
chip::Dnssd::ServiceAdvertiser::Instance().Shutdown();
    ⋮
mCommissioningWindowManager.Cleanup();
```

but the latter restarts `Dnssd::ServiceAdvertiser`.

Instance of project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

Add `CommissioningWindowManager::Shutdown()` which does not restart DNS.

#### Testing

If `ObjectPool` checks that objects do not outlive it
(originally part of PR project-chip#11698 but deferred due to current leaks),
then `TestCommissionManager` fails without this change.
@kpschoedel
Copy link
Contributor Author

@kpschoedel
Copy link
Contributor Author

kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 19, 2021
#### Problem

`echo_requester.cpp` leaks TCP endpoints.

Instance of project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

Shut down `TCPManager`.

#### Testing

If `ObjectPool` checks that objects do not outlive it
(originally part of PR project-chip#11698 but deferred due to current leaks),
then Cirque CI fails without this change.
kpschoedel added a commit that referenced this issue Nov 21, 2021
#### Problem

`echo_requester.cpp` leaks TCP endpoints.

Instance of #11880 _Possible use of destroyed pool objects_

#### Change overview

Shut down `TCPManager`.

#### Testing

If `ObjectPool` checks that objects do not outlive it
(originally part of PR #11698 but deferred due to current leaks),
then Cirque CI fails without this change.
Damian-Nordic pushed a commit that referenced this issue Nov 22, 2021
#### Problem

`chip::Server::Shutdown()` contains

```
chip::Dnssd::ServiceAdvertiser::Instance().Shutdown();
    ⋮
mCommissioningWindowManager.Cleanup();
```

but the latter restarts `Dnssd::ServiceAdvertiser`.

Instance of #11880 _Possible use of destroyed pool objects_

#### Change overview

Add `CommissioningWindowManager::Shutdown()` which does not restart DNS.

#### Testing

If `ObjectPool` checks that objects do not outlive it
(originally part of PR #11698 but deferred due to current leaks),
then `TestCommissionManager` fails without this change.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 29, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 29, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

Instance of project-chip#11880 Possible use of destroyed pool objects

`mTransportMgr` continues to hold `UDPEndPoint`s after
Inet is shut down via `PlatformMgr().Shutdown()`.

#### Change overview

- Shut down the `TransportMgr` before `PlatformMgr().Shutdown()`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Nov 30, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 Possible use of destroyed pool objects

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
  **XXX file issue**
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Adds a template argument to choose between two options when an
  `ObjectPool` is destroyed with live objects: to either release
  all objects (which calls their destructors), or to die with an
  error message.
- For existing cases in `SessionManager`, free leftover objects.
- Fix shutdown ordering in `DeviceControllerSystemState`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add a `BitMapObjectPool` template argument indicating what to
  do if it is destroyed with live objects: abort  with an error
  message, release all objects (which calls their destructors),
  or (transitionally) ignore the condition.
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add a `BitMapObjectPool` template argument indicating what to
  do if it is destroyed with live objects: abort  with an error
  message, release all objects (which calls their destructors),
  or (transitionally) ignore the condition.
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument indicating what to do if
  it is destroyed with live objects: abort with an error message,
  release all objects (which calls their destructors), or ignore
  the condition (transitionally, until all leaks are fixed).
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add a `BitMapObjectPool` template argument indicating what to
  do if it is destroyed with live objects: abort  with an error
  message, release all objects (which calls their destructors),
  or (transitionally) ignore the condition.
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument indicating what to do if
  it is destroyed with live objects: abort with an error message,
  release all objects (which calls their destructors), or ignore
  the condition (transitionally, until all leaks are fixed).
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument indicating what to do if
  it is destroyed with live objects: abort with an error message,
  release all objects (which calls their destructors), or ignore
  the condition (transitionally, until all leaks are fixed).
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 1, 2021
#### Problem

Instance of project-chip#11880 Possible use of destroyed pool objects

`mTransportMgr` continues to hold `UDPEndPoint`s after
Inet is shut down via `PlatformMgr().Shutdown()`.

#### Change overview

- Shut down the `TransportMgr` before `PlatformMgr().Shutdown()`.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 2, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument indicating what to do if
  it is destroyed with live objects: abort with an error message,
  release all objects (which calls their destructors), or ignore
  the condition (transitionally, until all leaks are fixed).
- Fix shutdown ordering in `DeviceControllerSystemState`.
- For existing pools in `SessionManager`, `InteractionModelEngine`,
  and `GroupDataProviderImpl`, ignore the condition.

#### Testing

CI; no changes to functionality.
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this issue Dec 2, 2021
#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (project-chip#11983, project-chip#12031), but there are still
a few remaining.

Fixes project-chip#11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument specifying what to do if
  it is destroyed with live objects: abort with an error message
  (the default), release the live objects (which calls their
  destructors), or ignore the condition (transitionally, until
  all leaks are fixed).

- Fix shutdown ordering in `DeviceControllerSystemState`.

- For existing pools in `SessionManager`, `InteractionModelEngine`,
  and `GroupDataProviderImpl`, ignore the condition.

#### Testing

CI; no changes to functionality.
andy31415 pushed a commit that referenced this issue Dec 4, 2021
* Catch or release ObjectPool leaks

#### Problem

No action is taken if an `ObjectPool` is destroyed while objects
remain live. For the `BitMapObjectPool` case, such objects can't
be safely touched. For `HeapObjectPool` such objects can be used
but can't be released.

Some leaks have been fixed (#11983, #12031), but there are still
a few remaining.

Fixes #11880 _Possible use of destroyed pool objects_

#### Change overview

- Add an `ObjectPool` template argument specifying what to do if
  it is destroyed with live objects: abort with an error message
  (the default), release the live objects (which calls their
  destructors), or ignore the condition (transitionally, until
  all leaks are fixed).

- Fix shutdown ordering in `DeviceControllerSystemState`.

- For existing pools in `SessionManager`, `InteractionModelEngine`,
  and `GroupDataProviderImpl`, ignore the condition.

#### Testing

CI; no changes to functionality.

* new uses in #12417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant