This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 34ca2a5ed system/uorb: bump listener stack when float print extension 
is on
34ca2a5ed is described below

commit 34ca2a5ed86aa8c7fc84118b1963ceff0b6cfc27
Author: Felipe Moura <[email protected]>
AuthorDate: Tue Sep 15 20:41:00 2026 -0300

    system/uorb: bump listener stack when float print extension is on
    
    uorb_listener's %pB debug printing (orb_info() -> lib_bsprintf()) does
    real floating-point-to-string conversion synchronously, in the
    listener's own task -- not a lightweight pointer dump. With
    CONFIG_LIBC_PRINT_EXTENSION off, %pB just prints a raw pointer and the
    default CONFIG_UORB_STACKSIZE (DEFAULT_TASK_STACKSIZE, 2048 on most
    configs) is plenty. With it on, decoding a topic's float fields through
    this path silently overflows a 2048-byte stack -- confirmed on real
    hardware (ESP32-S3, one push every ~10-20ms from two subscribed
    topics): uorb_listener hangs completely after printing only a partial
    topic name, no panic, no stack dump, nothing -- because
    CONFIG_SCHED_STACKGUARD/CONFIG_STACK_COLORATION aren't on by default
    either, so there's no guard to catch the overflow before it corrupts
    adjacent memory.
    
    Raising the default only when CONFIG_LIBC_PRINT_EXTENSION is set (not
    unconditionally, and not keyed off CONFIG_DEBUG_UORB specifically,
    since anything else that selects the same libc extension hits the same
    path) keeps the common case -- raw pointer output, small stack --
    exactly as before, and only pays for the extra stack when the feature
    that needs it is actually enabled.
    
    4096 was verified sufficient (tested against 2048, which reproduces
    the hang, and 8192, which also works but wastes RAM); reproduced
    cleanly across multiple fresh boots.
    
    Note: this default only applies when CONFIG_UORB_STACKSIZE has never
    been explicitly recorded in .config. Like any Kconfig int default,
    flipping CONFIG_LIBC_PRINT_EXTENSION on in an existing .config that
    already has an explicit CONFIG_UORB_STACKSIZE value won't retroactively
    raise it; the value has to be re-picked (e.g. via a fresh olddefconfig
    after removing the stale line, or manually).
    
    Signed-off-by: Felipe Moura <[email protected]>
---
 system/uorb/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/system/uorb/Kconfig b/system/uorb/Kconfig
index e72ae4f60..993211a04 100644
--- a/system/uorb/Kconfig
+++ b/system/uorb/Kconfig
@@ -16,6 +16,7 @@ config UORB_PRIORITY
 
 config UORB_STACKSIZE
        int "stack size"
+       default 4096 if LIBC_PRINT_EXTENSION
        default DEFAULT_TASK_STACKSIZE
 
 config UORB_FORMAT

Reply via email to