Skip to content

netutils/mdns: raise responder stack size default to 8KiB#3630

Open
ricardgb wants to merge 1 commit into
apache:masterfrom
ricardgb:mdns-stacksize-default
Open

netutils/mdns: raise responder stack size default to 8KiB#3630
ricardgb wants to merge 1 commit into
apache:masterfrom
ricardgb:mdns-stacksize-default

Conversation

@ricardgb

Copy link
Copy Markdown

Summary

CONFIG_NETUTILS_MDNS_STACKSIZE defaulted to DEFAULT_TASK_STACKSIZE,
which resolves to as little as 2KiB on some targets. The bundled mjansson
mDNS responder needs a deeper stack than that — DNS record parsing with
name decompression, plus the send/receive buffers — so on those targets it
overflows its stack and hardfaults at startup, before it can answer a
single query.

This raises the default to 8KiB (the value that reliably runs the
responder) and corrects the help text, which previously claimed a "4KiB"
default that did not match DEFAULT_TASK_STACKSIZE.

Impact

  • Fixes a startup hardfault when the mDNS app/daemon is enabled on targets
    with a small DEFAULT_TASK_STACKSIZE.
  • No API change; configurations that already set an explicit stack size are
    unaffected.

Testing

Reproduced and fixed on a Raspberry Pi Pico 2 W (RP2350, NuttX). With the
old default (2KiB on this target) the responder overflowed its stack and
hardfaulted at startup; with the new 8KiB default it runs and answers mDNS
queries normally (verified with avahi-resolve/avahi-browse from a host).


Disclosure: this change was prepared by an AI agent (Claude Code) at the
direction of the author (@ricardgb), who reviewed it before submission.

🤖 Generated with Claude Code

@Abhishekmishra2808

Copy link
Copy Markdown
Contributor

@ricardgb, please sign your commit message with git commit -s (https://nuttx.apache.org/docs/latest/contributing/guide.html#commit-requirements).
Also, rebase the branch; then the checks will pass.

CONFIG_NETUTILS_MDNS_STACKSIZE defaulted to DEFAULT_TASK_STACKSIZE,
which resolves to as little as 2KiB on some targets.  The bundled
mjansson responder uses a deeper stack than that (DNS record parsing
with name decompression, plus the send/receive buffers) and overflows
on startup, taking the board down with a hardfault before it answers a
single query.

Default to 8KiB, the value that reliably runs the responder, and
correct the help text, which previously claimed a 4KiB default that did
not match DEFAULT_TASK_STACKSIZE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Ricard Rosson <ricard@groundbits.com>
@ricardgb ricardgb force-pushed the mdns-stacksize-default branch from d4716e0 to d024b03 Compare July 11, 2026 16:12

@linguini1 linguini1 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.

Please use the Assisted-by: field from the contribution guide. Also, please attach your test logs from your testing on the Pico.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants