-
Notifications
You must be signed in to change notification settings - Fork 200
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
Resource leak in MemPool tests #1776
Comments
Note - this test has another issue in that it creates 3 pools but passes the same memory block to all 3. This will likely end up corrupting the pool management structures for the first 2. The test should either make 3 separate memory blocks, or delete the pool before creating the next one (i.e. one at a time). |
zanzaben
added a commit
to zanzaben/cFE
that referenced
this issue
Aug 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The
TestMemPoolCreate
function creates 3 memory pools in total - whenever CFE_SUCCESS is returned, this means a pool was instantiated.See here:
cFE/modules/cfe_testcase/src/es_mempool_test.c
Line 43 in cfadad6
cFE/modules/cfe_testcase/src/es_mempool_test.c
Line 48 in cfadad6
cFE/modules/cfe_testcase/src/es_mempool_test.c
Line 53 in cfadad6
However, only the last pool ID is deleted here:
cFE/modules/cfe_testcase/src/es_mempool_test.c
Line 58 in cfadad6
The other two pools are left hanging, and are automatically cleaned up by CFE ES at the time the app exits itself, as designed. However, in the case of the pool with an embedded mutex (the one created at line 48) the mutex will be deleted by both CFE ES resource cleanup and task cleanup, due to the fact that the mutex was created by the task.
Note that the ID validation works, and the mutex is only deleted once - task cleanup gets to it first, and when pool cleanup tries to delete it again, the ID is reported as stale and nothing is deleted, but it does issue a warning about it right here:
cFE/modules/es/fsw/src/cfe_es_mempool.c
Line 415 in cfadad6
To Reproduce
Execute CFE functional tests, observe an unexpected warning in the syslog when the test completes:
Expected behavior
Test should delete all the pools it creates, and this clean up warning should not happen
System observed on:
Ubuntu
Additional context
In a way, this could be considered a happy accident, as it verifies that stale ID rejection is occurring, and everything is working as designed. As a result, there is no real harm done by this double delete, aside from the extra warning.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: