Skip to content

CFE_EVS_SendHkCmd only clears the first unused AppData slot in the housekeeping packet #2836

Open

Description

@philphauler

Describe the bug

Hi cFE team, thanks for the very readable EVS code. This one was easy to pin down because the fill loop right above it shows the intended shape.

In CFE_EVS_SendHkCmd (modules/evs/fsw/src/cfe_evs_task.c) the loop that clears the unused tail of EVS_TlmPkt.Payload.AppData never advances AppTlmDataPtr, so only slot [j] is cleared. Slots [j+1 ..] keep whatever was written on an earlier housekeeping cycle. EVS_TlmPkt lives in CFE_EVS_Global and is initialized once in task init, so when two or more apps are unregistered between housekeeping reports the packet keeps reporting the deleted apps' AppID, enable status and counters.

To Reproduce

  1. Register three apps with EVS, send housekeeping.
  2. Unregister two of them (CFE_ES_StopApp calls CFE_EVS_CleanUpApp, which frees the AppData entry).
  3. Send housekeeping again: AppData[1] is cleared, AppData[2] still carries the old AppID and counters.

Unit-test version (evs_UT.c Test_Misc): mark 3 entries used, CFE_EVS_SendHkCmd(NULL), free entries 1 and 2, call again, check Payload.AppData[2].AppID == CFE_ES_APPID_UNDEFINED. On dev it reads AppID 0x110001 and AppMessageSentCounter 102.

Expected behavior

Every unused slot after the last registered app reads AppID UNDEFINED, enable false, counters 0.

Code snips

cfe_evs_task.c clear loop, dev 2612eb0 lines 391-397. Introduced in 2efe70b (2020, Fix #797), which changed the clear loop from AppData[i].AppID = 0 to AppTlmDataPtr->AppID = 0 without adding the increment.

System observed on

Native build of the cFS dev bundle, Ubuntu 22.04 (WSL2), gcc, coverage-evs unit test.

Additional context

Telemetry-only, no memory corruption (the single written slot is always in bounds). One-line fix plus a regression test is ready, I will open the PR right after this. Have a great day!

Reporter Info

Filip Koscak, phil.phaulre@gmail.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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