cederom commented on PR #4208: URL: https://github.com/apache/nuttx-apps/pull/4208#issuecomment-7296761864
Thank you @casaroli please take a look at 3 remarks below worth fixing :-) I read both PRs in full: the kernel commit 7c28015, the test commit a750406, and the scheduler and signal code around them. **Verdict: #22582 is correct and safe to merge. #4208 is fine, but its timing is fragile and needs one fix before it leaves draft.** I didn't build or run either one. ## apache/nuttx-apps#4208 — `testing/sched/waitstop` The test design is good. Holding the SIGUSR2 until after the old 3 s timeout would have fired is a neat way to catch the stale watchdog. Returning the result through the exit status (where only 4 means pass) means a child that crashes or hangs can't pass by accident. The Kconfig help text is updated, and nxstyle is clean. **Issues:** 1. **It can fail falsely on slow targets (should fix before leaving draft).** The parent assumes that after `msleep(1000)` the child's thread is already in `sigtimedwait()`. If spawning and setup take longer, for example loading the ELF from a slow filesystem or a busy QEMU, the SIGSTOP comes before the wait starts. The thread then times out with EAGAIN, sets bit 1, and the test reports FAIL with no kernel bug. A handshake would fix this: for example, the child sends SIGUSR1 to `getppid()` just before the wait and the parent waits for it, keeping a short delay after it. Or the thread can record the time and report "the stop came before the wait" as its own exit code, which the parent counts as a skip rather than a failure. 2. **It depends on which thread gets the stop.** The comment says the last thread created gets the stop. That holds only because of how NuttX orders a group's threads: `group_foreachchild()` walks `tg_members`, and `group_signal()` picks the first thread that has the signal unblocked. If that ever changes and the waiting thread gets SIGSTOP itself, the test still passes but no longer tests anything. It never fails falsely, so the comment should just say this is a NuttX implementation detail rather than something guaranteed. 3. **Minor:** `pthread_create()` failures return 8, but the parent reports every result as "exit ok %d, status 0x%x". That's fine, though a decoded message would be easier to read when it fails. The main thread's `pthread_join()` is safe across the stop, because it uses `nxsem_wait_uninterruptible()` on `join_sem`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
