Repository navigation
CfdpManager: degrade instead of asserting when the message queue is full - #6418
bitWarrior wants to merge 1 commit into
Conversation
run1Hz, dataIn, dataReturnIn and every command used the default queue-full behavior, so a message that arrived at a full queue raised a FATAL assertion. Received PDUs arrive at the rate the link delivers them, so a burst that gets ahead of the component thread could end the process hosting CfdpManager. Give each of these inputs a non-fatal queue-full policy: - dataIn: drop the PDU, return its buffer through dataInReturn, count it in recvDropped and emit the throttled DataInQueueOverflow warning. - dataReturnIn: deallocate the buffer directly, so nothing leaks. - run1Hz: drop the tick. - commands: respond BUSY and emit the throttled CommandQueueOverflow warning. The hooks run on the caller's thread and use only output ports, events and atomic counters. The dataIn drop count is folded into telemetry on the component thread at the next run1Hz cycle, which also re-arms the throttled events after a cycle with no overflow. Add unit tests for each input and document the behaviour and requirement CFDP-016 in the SDD. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Coverage report — base
|
| Module | Line | Δ | Function | Δ | Branch | Δ |
|---|---|---|---|---|---|---|
Os/Generic |
89.78 | -0.50 | 89.13 | +0.00 | 75.29 | -0.19 |
Svc/Ccsds/CfdpManager |
90.38 | -0.42 | 95.24 | -1.65 | 78.19 | +0.09 |
Os/Posix |
70.64 | -0.39 | 87.50 | +0.00 | 50.89 | +0.00 |
Fw/DataStructures |
97.69 | -0.35 | 97.14 | +0.00 | 82.30 | -0.55 |
Os/Generic/Types |
92.14 | +0.35 | 92.86 | +0.00 | 72.90 | -2.80 |
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
|
Hello @bitWarrior, and thank you for contributing to F´! This pull request is signed At the moment this PR does not link to an issue that the CCB has reviewed. Recommendation to maintainers: close this PR for now, and reopen it once the CCB has weighed in on the linked issue(s). If the CCB approves, the work here can be picked back up immediately. This is an automated notice from |
|
A generic approach should be agreed upon at the framework level, not for every async port instance. Opened #6422 to discuss |
Summary
CfdpManager asserts when its message queue fills.
run1Hz,dataIn,dataReturnInand all nine commands use the default queue-full behavior, so a message that arrives at a full queue hitsFW_ASSERT(qStatus == Os::Queue::OP_OK)and the deployment aborts. OnlypingIndeclaresdrop.Received PDUs arrive at the rate the link delivers them. If the upstream producer gets one queue depth ahead of the component thread (30 messages in the stock
FileHandlingCfdpconfiguration), the next PDU ends the process that hosts CfdpManager. This is the same pattern #6389 addresses inSvc::CmdDispatcher.Changing
dataInalone would not be enough. All of these inputs share one queue, so once received traffic keeps it full, the next 1 Hz tick, returned buffer or command reaches the same assertion.Changes
run1Hzgetsdrop;dataIn,dataReturnInand every command gethook.dataIn: the PDU is dropped. The buffer goes back throughdataInReturn, the drop is counted, and the newDataInQueueOverflowevent is emitted. Class 2 recovers through NAK or timer retransmission; Class 1 loses the PDU.dataReturnIn: the buffer is deallocated throughbufferDeallocatedirectly. Nothing is lost, because that is all the handler does.BUSYand the newCommandQueueOverflowevent is emitted.dataIndrop count is added torecvDroppedon the component thread at the nextrun1Hz.DataInQueueOverflowandCommandQueueOverflow, both warning high and throttled to 5. Each is re-armed by the firstrun1Hzcycle with no overflow of its kind.QueueOverflow.*), each filling the test queue before sending one more message:DataIn: the buffer is returned at once, the event is emitted, andrecvDroppedrises at the next tick.DataInEventThrottle: only 5 events for a longer burst, and the event fires again after a clean cycle.DataReturnIn: the buffer is deallocated at once.Run1Hz: the tick is dropped and the next one is handled normally.Command:BUSYresponse and event for a command with and without arguments, and neither command runs.Testing
CfdpManager UTs: 222/222 pass. The new tests cannot be built against the old model, since they use the new events; before this change the same sequence (fill the queue, send one more
dataIn) aborts with the queue-full assertion. No deployment was built for this change.Notes
run1Hztick is silent. Protocol timers and telemetry slip one second per dropped tick.pingInalready drops, so a queue that stays full shows up through the health monitor.BUSY, where Svc/CmdDispatcher: drop instead of assert when compCmdStat or own commands overflow the queue #6389 leaves a dropped CmdDispatcher command without a response. Here the hook can respond, so the command does not stay pending.bufferDeallocatenow also receives calls from the thread that drivesdataReturnIn.Svc::BufferManageralready handles this.AI Usage
Generative AI was used in this contribution: AI. The code change, unit tests, SDD text, and this description were written with Claude Code and reviewed by the contributor.
🤖 Generated with Claude Code
IAMAI