Repository navigation
Svc/Ccsds/SpacePacketFramer: emit SUCCESS on comStatusOut when buffer allocation fails - #5972
Conversation
… allocation fails When bufferAllocate returns an invalid or undersized buffer, the framer dropped the packet and returned the data buffer without producing any status, so the upstream Svc::ComQueue waited forever. Per the Framer Status Protocol a message that produces zero frames must be acknowledged with Fw::Success::SUCCESS. This is the same defect fixed in Svc/FprimeFramer by nasa#5943. Fixes nasa#5971
| @@ -82,8 +84,10 @@ class SpacePacketFramerTester final : public SpacePacketFramerGTestBase { | |||
|
|
|||
| U16 m_nextSeqCount; // Sequence count to be returned by getApidSeqCount output port | |||
There was a problem hiding this comment.
[C++ Design] future work m_nextSeqCount has no initializer (CPP-19).
The neighbouring fixture flags are initialized in-class, but m_nextSeqCount is left indeterminate and the constructor does not set it. from_getApidSeqCount_handler returns it, so any test that reaches getApidSeqCount without assigning it first reads an uninitialized U16. Preexisting; the PR does not widen it (the new allocation-failure tests return before the sequence-count lookup). Consider U16 m_nextSeqCount = 0;.
| } | ||
| this->dataReturnOut_out(0, data, context); | ||
| // No frame produced: report SUCCESS so the upstream ComQueue keeps sending (Framer Status Protocol) | ||
| if (this->isConnected_comStatusOut_OutputPort(0)) { |
There was a problem hiding this comment.
[Operational] could fix Under sustained pool exhaustion this turns a ComQueue stall into a full-rate drain of the ComQueue backlog, visible for only 5 drops per process lifetime.
Trace: each SUCCESS re-arms ComQueue (async comStatusIn -> processQueue -> dataOut), so with the ComCcsds defaults up to 800 queued packets (events 200 + tlm 500 + file 100) are dequeued and dropped back-to-back on the ComQueue thread while commsBufferManager (20 + 30 buffers, shared with the uplink path) stays empty.
NoBufferAvailable is throttle 5 and nothing in this component calls _ThrottleClear(), so after the first 5 drops of the deployment's life later exhaustion episodes show up only in BufferManager NoBuffs; FileDownlink sees its buffer returned via dataReturnOut and advances as if the chunk were sent.
Operational judgment call: same tradeoff already accepted for FprimeFramer (#5943); the consequence is bounded by the queue depths and documented as a drop.
Smallest remedy: re-arm the event (clear the throttle on the first successful allocation after a failure, or a DpManager-style CLEAR_EVENT_THROTTLE command) and mirror it in FprimeFramer.
cc @LeStarch @thomas-bc — low-confidence finding, please confirm.
thomas-bc-autowot
left a comment
There was a problem hiding this comment.
Automated review summary (run 1)
Per-agent results
| Agent | must fix | suggestion | could fix | future work | outstanding | Verdict |
|---|---|---|---|---|---|---|
| Security Vulnerabilities | 0 | 0 | 0 | 0 | 0 | Go |
| Supply Chain / Runner Safety | 0 | 0 | 0 | 0 | 0 | Go |
| F Prime C/C++ Design | 0 | 0 | 0 | 1 | 1 | Go |
| Documentation Currency | 0 | 0 | 0 | 1 | 0 | Go |
| Design | 0 | 0 | 0 | 0 | 0 | Go |
| Architecture | 0 | 0 | 0 | 0 | 0 | Go |
| Test Quality | 0 | 2 | 0 | 1 | 3 | Go |
| Correctness | 0 | 0 | 0 | 0 | 0 | Go |
| Operational | 0 | 0 | 2 | 0 | 2 | Go |
| Maintainability | 0 | 0 | 0 | 0 | 0 | Go |
| CI safety | — | — | — | — | — | Go |
| Totals | 0 | 2 | 2 | 3 | 6 | Go |
Supply-chain surfaces
| Surface | Outstanding |
|---|---|
| Dependencies | clean |
| Vendored / submodule | clean |
| Build / test infrastructure | clean |
| Workflows / actions / scripts | clean |
| Generator output | clean |
| Prompt-injection | clean |
| Review-system integrity | clean |
Merge readiness
Merge readiness: Go — all ten reviewers completed with zero outstanding must-fix findings; @LeStarch and @thomas-bc requested for human review.
Clean telemetry from all ten stations — the framer's status link is clear for the maintainers' go/no-go poll.
Co-authored-by: thomas-bc-autowot <[email protected]>
Co-authored-by: thomas-bc-autowot <[email protected]>
Co-authored-by: thomas-bc-autowot <[email protected]>
…stion (clang-format)
Coverage report — base
|
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Fw/DataStructures |
97.96 | +0.63 | 97.14 | +0.00 | 82.66 | +1.09 |
Svc/Ccsds/SpacePacketFramer |
97.92 | +11.56 | 100.00 | +0.00 | 90.91 | +21.68 |
New modules
| Module | Line | Function | Branch |
|---|---|---|---|
Fw/Prm |
0.00 | 0.00 | 0.00 |
Modules without UTs
CFDP/Checksum/GTest, Drv/LinuxGpioDriver, Drv/LinuxI2cDriver, Drv/LinuxSpiDriver, Drv/Ports/DataTypes, Drv/PosixUartDriver, FppTestProject/FppTest/topology/async, FppTestProject/FppTest/topology/components/Comp, FppTestProject/FppTest/topology/components/Framework, FppTestProject/FppTest/topology/components/Receiver, FppTestProject/FppTest/topology/components/Sender, FppTestProject/FppTest/topology/guarded, FppTestProject/FppTest/topology/sync, FppTestProject/FppTest/topology/top_ports, FppTestProject/FppTest/topology/types, Fw/Com, Fw/Comp, Fw/FilePacket/GTest, Fw/Fpy, Fw/Obj, Fw/Port, Fw/Sm, Fw/Test, Fw/Types/GTest, Os/Models, Svc/Ccsds/Types, Svc/Ccsds/Utils, Svc/FatalHandler, Svc/Subtopologies/CdhCore, Svc/Subtopologies/ComCcsds, Svc/Subtopologies/ComCcsdsSdls, Svc/Subtopologies/ComFprime, Svc/Subtopologies/ComLoggerTee, Svc/Subtopologies/DataProducts, Svc/Subtopologies/DpCompression, Svc/Subtopologies/FileHandling, Svc/Subtopologies/FileHandlingCfdp, Svc/Subtopologies/FileHandlingCfdp/FileHandlingCfdpConfig, TestDeploymentsProject/Ref/DpDemo, TestDeploymentsProject/Ref/PingReceiver, TestDeploymentsProject/Ref/RecvBuffApp, TestDeploymentsProject/Ref/SendBuffApp, TestDeploymentsProject/Ref/Top, TestDeploymentsProject/Ref/TypeDemo, cmake/test/data/TestConfigDeployment, cmake/test/data/TestDeployment/TestBuildAutocoder, cmake/test/data/TestDeployment/TestDuplicateDirective, cmake/test/data/TestDeployment/TestHeaderAutocoder, cmake/test/data/TestDeployment/TestLinkDepends, cmake/test/data/TestDeployment/TestRelative, cmake/test/data/test-fprime-library/TestLibrary/TestComponent, cmake/test/data/test-fprime-library2/TestLibrary2/TestComponent
… allocation fails (nasa#5972) * Svc/Ccsds/SpacePacketFramer: emit SUCCESS on comStatusOut when buffer allocation fails When bufferAllocate returns an invalid or undersized buffer, the framer dropped the packet and returned the data buffer without producing any status, so the upstream Svc::ComQueue waited forever. Per the Framer Status Protocol a message that produces zero frames must be acknowledged with Fw::Success::SUCCESS. This is the same defect fixed in Svc/FprimeFramer by nasa#5943. Fixes nasa#5971 * Update Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp Co-authored-by: thomas-bc-autowot <[email protected]> * Update Svc/Ccsds/SpacePacketFramer/docs/sdd.md Co-authored-by: thomas-bc-autowot <[email protected]> * Update Svc/Ccsds/SpacePacketFramer/test/ut/SpacePacketFramerTester.cpp Co-authored-by: thomas-bc-autowot <[email protected]> * Svc/Ccsds/SpacePacketFramer: realign test comment after applied suggestion (clang-format) --------- Co-authored-by: thomas-bc-autowot <[email protected]> (cherry picked from commit c007687)
Change Description
When the frame buffer allocation fails (invalid buffer, or one smaller than requested),
SpacePacketFramernow emits oneFw::Success::SUCCESSoncomStatusOutafter returning the data buffer, exactly likeFprimeFramerdoes since #5943. Nothing else on that path changes:NoBufferAvailableis still logged, an undersized buffer is still deallocated, and no frame goes out ondataOut.Also:
InvalidAllocationEmitsComStatusandUndersizedAllocationEmitsComStatus, matching the ones Svc/FprimeFramer: emit SUCCESS on comStatusOut when frame buffer allocation fails #5943 added for FprimeFramer.Svc/Ccsds/SpacePacketFramer/docs/sdd.md: documents the drop path and adds requirement SPF-011.I opened this together with #5971 because it mirrors #5943 line for line. Happy for it to go through CCB first.
Rationale
In
ComCcsds,spacePacketFramer.comStatusOutgoes directly toComQueue, which only leavesWAITINGon a returned status. One transientNoBufferAvailabletherefore stalls downlink for good, which is the failure #5894 described for FprimeFramer. The nominal path is unchanged: a produced packet still relies on the status coming back from downstream. No FPP or interface change.Testing/Review Recommendations
fprime-util checkinSvc/Ccsds/SpacePacketFramer: 6/6 pass. With onlySpacePacketFramer.cppreverted toa41532adecand the tests kept, 4/6 pass and both new tests fail on the emptycomStatusOuthistory.fprime-util check --allwith the change: 133/133 pass.clang-formatwith the repository config: no changes.Svc/ComAggregator/docs/sdd.mdalone because Svc.ComAggregator: consolidate idle filling and configuration #5939 is rewriting it; it could list SpacePacketFramer next to FprimeFramer once that lands.Future Work
None.
AI Usage (see policy)
This contribution comes out of a defect-hunting pipeline I build and run (Dev-next-gen). It uses Claude Code with Anthropic's Claude Opus 5.
SpacePacketFramer.cpp, the tests undertest/ut, anddocs/sdd.md.IAMAI
"Nothing this pipeline produces is submitted without human approval. The entire pull request — the code change, the tests, the SDD update and this description — was reviewed by a human before the pipeline was allowed to submit it. This includes the
ComCcsdswiring and the Framer Status Protocol table the fix relies on."(@Dev-next-gen)