Skip to content

Svc/GenericHub: drop message with event and counter on allocation failure instead of asserting - #278

Open
devin-ai-integration[bot] wants to merge 13 commits into
develfrom
devin/1791764453-generichub-alloc-failure
Open

devin-ai-integration[bot] wants to merge 13 commits into
develfrom
devin/1791764453-generichub-alloc-failure

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Related Issue(s) nasa#6166
Has Unit Tests (y/n) y
Documentation Included (y/n) y
Generative AI was used in this contribution (y/n) AI

Change Description

GenericHub::send_data no longer asserts when allocate returns an invalid buffer (null data, or smaller than the framed message). It now:

  • drops the message (an undersized non-null buffer is returned via deallocate; bufferIn buffers still go back on bufferInReturn);
  • increments std::atomic<U32> m_numAllocationFailures on every drop, published as telemetry NumAllocationFailures from a new sync input port schedIn: Svc.Sched;
  • reports once per failure episode: the drop that wins std::atomic<bool> m_reportingFailure.exchange(true) emits event BufferAllocationFailed(msgType: HubType, port, size) (WARNING_HI) and one Fw::Logger line; later drops are only counted until the next successful send clears the flag;
  • for a dropped cmdDispIn command, replies EXECUTION_ERROR on the matching cmdRespOut so the originator is not left waiting.

The hub message type is now an FPP enum declared in the component (enum HubType : U32 { HUB_TYPE_PORT, HUB_TYPE_BUFFER, HUB_TYPE_EVENT, HUB_TYPE_CHANNEL, HUB_TYPE_CMD_DISP, HUB_TYPE_CMD_RESP }, same values and wire format as before) so the event argument is typed in the dictionary. API note for projects: the C++ Svc::GenericHub::HubType enum is replaced by the generated Svc::GenericHub_HubType (HUB_TYPE_MAX becomes GenericHub_HubType::NUM_CONSTANTS).

New special ports Log/LogText/Time/Tlm. Telemetry is written only from schedIn (not on the failure path) because the hub is often its own event/telemetry sink and emitting synchronously would re-enter it while the pool is exhausted; existing deployments must wire schedIn to a rate group to see the counter. The Fw::Logger line is for the side of the link whose own event cannot get out through the exhausted hub.

Documentation: the GenericHub SDD gains a "Transport formations" section that makes hub.toBufferDriver -> Svc.ComQueue -> Svc.ComStub -> driver the recommended hub wiring (bounded buffering across a link outage, outside the passive hub), with the transport requirements (message boundaries: UDP natively, TCP/UART through F´ framing plus a receive-side adapter the framework does not provide; UDP send errors stall the queued wiring until reconnect) and the sizing rule (D >= N, Q >= N + 8). hub-pattern.md presents the same wiring; the ComQueue SDD notes the hub as a bufferQueueIn producer. The design behind this (hub stays passive, no in-hub queue, Svc.ComRetry excluded) was settled with the maintainers before implementation.

Rationale

CCB on nasa#6166: "don't assert, add event and counter". A pool exhaustion killed the FSW; now it is counted, evented and survivable, and the documented topology gives projects buffering across link outages without adding state to the hub.

Testing/Review Recommendations

  • Svc/GenericHub UTs: 14 pass (null / undersized allocation for every message type, deallocate of undersized buffer, one event + one logger line per episode re-armed by a successful send, counter via schedIn, recovery, cmdDispIn fail-back incl. malformed packet and a CmdSplitter-consumed buffer, hub as its own event sink with an empty pool — bounded re-entry — and with the pool recovering, buffer returned from another thread after the send). Full fprime UT suite 135/135 on current devel.
  • fprime-generic-hub-reference rebuilt against this branch with both deployments on the recommended ComQueue + ComStub wiring: integration suite 8/8 (round trips, remote command, NumAllocationFailures == 0, ComQueue depth telemetry, no BufferAllocationFailed/QueueOverflow). Companion PR: JPL-Devin/fprime-generic-hub-reference (linked below once open).
  • Review focus: send_data failure branch and the cmdDispIn_handler fail-back; the HubType enum move (same values, same framing); SDD "Allocation failure" and "Transport formations".

Future Work

None planned: the queued hub topic was closed in favour of the documented topology; UDP recovery after a send error and a framing adapter for stream transports are documented limitations.

Contributor Checklist

AI Usage (see policy)

Implementation, FPP, unit tests and documentation were written by an AI agent following the component-development skills, under maintainer direction (requirements, once-per-episode reporting, std::atomic, Fw::Logger, sched-port telemetry, cmdDispIn fail-back, the FPP enum typing and the recommended-wiring decision were maintainer decisions). Validated with the GenericHub UTs, the full UT suite, and the fprime-generic-hub-reference GDS integration tests; reviewed locally with the F´ multi-agent review pipeline.

IAMAI

Requested by: @thomas-bc-autobot

@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

Original prompt from thomas.boyer.chammard

@playbook:playbook-c60a4c0b400a4b3fa08f897a831c74d6 nasa#6166

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration
devin-ai-integration Bot changed the base branch from devel to dd/final November 5, 2026 19:57
@devin-ai-integration
devin-ai-integration Bot changed the base branch from dd/final to devel November 5, 2026 19:57
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 this pull request may close these issues.

1 participant