Skip to content

fix(radio): replace beginSending() asserts with graceful rejection - #11233

Closed
ndoo wants to merge 1 commit into
meshtastic:developfrom
meshmy:fix/radiointerface-beginsending-asserts
Closed

fix(radio): replace beginSending() asserts with graceful rejection#11233
ndoo wants to merge 1 commit into
meshtastic:developfrom
meshmy:fix/radiointerface-beginsending-asserts

Conversation

@ndoo

@ndoo ndoo commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Problem

RadioInterface::beginSending() guards four invariants with assert(): no send already in progress, payload already encrypted, sender node num set, and encrypted payload fits the radio buffer. On STM32WL these all hang forever with no diagnostic instead of dropping the one bad packet (__wrap___assert_func is while(true);).

Fix

Convert each assert() to a checked early return: log, release p, return 0. Both callers (RadioLibInterface::startSend(), SimRadio::startSend()) are updated to check for a 0 return and bail out cleanly instead of proceeding to transmit/use the now-released packet.

Test plan

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below): wio-e5 — build + hardware verified per test plan above. rak3172 build-verified only.

assert(!sendingPacket)/assert(payload variant)/assert(from)/assert(size)
in RadioInterface::beginSending() all hang forever with no diagnostic on
STM32WL instead of dropping one packet.

Return 0 and release p on any violated invariant instead. Updated both
callers (RadioLibInterface::startSend(), SimRadio::startSend()) to check
for a 0 return and bail out without touching the now-released packet.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Andrew Yong <me@ndoo.sg>
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e3375d3-587b-4c22-9195-7df9b40e4cf4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Note

Building this pull request… the flash button, badges and supported-board
list will appear here automatically once CI finishes.

@ndoo

ndoo commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Closing — this is superseded by @t-miura's #11223 (the RadioInterface.cpp/RadioLibInterface.cpp portions — null/size/variant checks in beginSending() and the numbytes==0 handling in startSend()) and #11229 (the SimRadio.cpp portion, which handles the same numbytes==0 case more thoroughly than this PR did — it changes startSend()'s signature to propagate success/failure back to onNotify() rather than just early-returning). Both were opened before this one. Thanks for the more complete fix!

@ndoo ndoo closed this Jul 26, 2026
@ndoo
ndoo deleted the fix/radiointerface-beginsending-asserts branch August 28, 2026 18:27
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