Skip to content

Bound interrupted-send retries in SendBuffered - #12168

Open
embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:zd22854
Open

embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:zd22854

Conversation

@embhorn

@embhorn embhorn commented Nov 18, 2026

Copy link
Copy Markdown
Member

Description

SendBuffered() retried WOLFSSL_CBIO_ERR_ISR with an unconditional continue that neither consumed retryLimit nor made progress, so a send callback that kept reporting an interrupt (persistent EINTR, NetX NX_WAIT_ABORTED, or a custom transport) spun the calling API forever.

Retry ISR up to WOLFSSL_MODE_AUTO_RETRY_ATTEMPTS times, then return WANT_WRITE with the output still buffered so the caller can resume. Transient interrupts are still absorbed transparently.

Fixes zd22854

Testing

Add test_wolfSSL_hs_send_buffered_isr covering transient and persistent interrupts, and document the behavior for EmbedSend and EmbedSendTo.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@embhorn embhorn self-assigned this Nov 18, 2026
@embhorn
embhorn requested review from wolfSSL-Fenrir-bot and a balanced review from Copilot November 18, 2026 00:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the bounded interrupted-send retry change.

No open issues 🎉

What changed in this PR

Bounds interrupted-send retries in SendBuffered() so persistent transport interrupts return WANT_WRITE instead of looping indefinitely, preserving buffered output for a later retry.

Changes:

  • Limits interrupt retries using WOLFSSL_MODE_AUTO_RETRY_ATTEMPTS.
  • Adds regression coverage for transient interrupts, retry exhaustion, and handshake recovery.
  • Documents interrupted-send behavior for EmbedSend and EmbedSendTo.
File Description
tests/​api/​test_ssl_hs.h Declares and registers the interrupted-send test.
tests/​api/​test_ssl_hs.c Tests bounded retries and recovery with buffered output.
src/​internal.c Bounds interrupt retries and returns WANT_WRITE when exhausted.
doc/​dox_comments/​header_files/​wolfio.h Documents the send retry limit and resulting behavior.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m3

  • FLASH: .text +8 B (+0.0%, 132,881 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +64 B (+0.0%, 252,610 B / 262,144 B, total: 96% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +64 B (+0.0%, 252,610 B / 262,144 B, total: 96% used)

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +104 B, text +13,192 B (+4.7%, 295,768 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #12168

Scan targets checked: wolfssl-src, wolfssl-bugs
Not reviewed (no scan target covers them): doc/dox_comments/header_files/wolfio.h, tests/api/test_ssl_hs.h
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

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.

3 participants