blues-fun opened a new pull request, #21799: URL: https://github.com/apache/nuttx/pull/21799
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary * Why change is necessary: a worker that exits on its own (processing error, or the last buffer of a playback) closes its message queue on the way out, and a following stop() sent into the closed queue crashed in nxmq_verify_send(), which breaks the test suite. stop() also returned before the worker released its queue and files, so a following configure() could run while still DRAINING. * What functional part of the code is being changed: drivers/audio/audio_fake.c only. * How the change exactly work: * stop() waits on an exit semaphore the worker posts as its last action, and checks the result of the stop message instead of ignoring it. start() reaps a worker that exited by itself before reinitializing. * stop() probes worker liveness through the exit semaphore first and reaps the thread without sending when it is already gone, which also makes stop() safe to call twice. Commits (3, one file): * audio/fake: synchronize stop() with worker thread shutdown * audio_fake: skip the stop message when the worker already exited * audio_fake: add blank lines after declarations ## Impact * Is new feature added? Is existing feature changed? YES — a crash fix in audio_fake; no API or struct changes. * Impact on user (will user need to adapt to change)? NO. * Impact on build (will build process change)? NO. * Impact on hardware (will arch(s) / board(s) / driver(s) change)? NO — internal to the driver. * Impact on documentation (is update required / provided)? NO. * Impact on security (any sort of implications)? NO. * Impact on compatibility (backward/forward/interoperability)? NO. ## Testing I confirm that changes are verified on local setup and works as intended: * Build Host(s): Linux x86_64. * Target(s): sim:alsa with CONFIG_AUDIO_FAKE (64-bit, SIM_M32 off) — the split branch builds and links clean, and checkpatch passes (run on this branch alone). * Steps to reproduce: mount a hostfs with a raw PCM file (2ch/16bit/48kHz), run nxplayer, `device /dev/audio/pcm2p`, `playraw <file> 2 16 48000 3`. Before the fix the session dumps core after the playback ends; with the fix it exits clean. Testing logs before change (upstream master): nsh> mount -t hostfs -o fs=/tmp/audio-test /host nsh> nxplayer NxPlayer version 1.05 h for commands, q to exit nxplayer> device /dev/audio/pcm2p nxplayer> playraw /host/in.pcm 2 16 48000 3 nxplayer> timeout: the monitored command dumped core Testing logs after change: nsh> mount -t hostfs -o fs=/tmp/audio-test /host nsh> nxplayer NxPlayer version 1.05 h for commands, q to exit nxplayer> device /dev/audio/pcm2p nxplayer> playraw /host/in.pcm 2 16 48000 3 nxplayer> q nsh> The before/after logs were captured on the full split series; the crash path is confined to this driver. The series was additionally verified on BES platform (Cortex-M55) real hardware. Not tested: protected and kernel builds, other architectures. -- 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]
