Repository navigation
automount: 4 kB of stack and 60 s to stop - what a mount sets going runs in its thread - #6
Merged
Merged
Conversation
The thread that mounts is the one dmvfs calls the _mount_changed listeners in. libsystemd loads <mount point>/cfg/services there and starts its units - a module loaded from the new file system with its dependencies: 2596 bytes of stack measured on STM32F746G-DISCO with the car HMI demo from the card, more than the 2 kB automount had (vApplicationStackOverflowHook, the system is dead). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
…system libsystemd hears the unmount in automount's thread: it runs the rules' remove units and stops the units that came from the file system (the car HMI demo takes seconds to stop), each with its own timeout. With 5 s for automount itself it was killed in the middle of the unmount: the card stayed mounted, the stop took minutes, and units were started again. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
JohnAmadis
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem 1 - the stack
automountis released with a 2 kB stack (2560 bytes with the overhead). The thread that mounts is also the one dmvfs calls the_mount_changedlisteners in (dmfsi's dif), and libsystemd uses that call to load<mount point>/cfg/servicesandcfg/rulesof the new file system and start its units (choco-technologies/dmsystem#9) - a module loaded from the new file system, with its dependencies, in automount's thread.Change
DMOD_STACK_SIZEofservices/automount2048 -> 4096.Measured (STM32F746G-DISCO)
Peak of automount's stack with the car HMI demo started from the card and the one-shot
devscan(choco-technologies/dmdevfs#75, #77) running: 2596 bytes (ps). With the 2 kB stack the thread overflows:vApplicationStackOverflowHook, the system is dead - seen on the board when a unit had to load its module from/ext(littlefs) inside the mount report. With 4 kB: cold boots in a row, the card mounts, carhmi starts from it.Problem 2 - the stop timeout
The same thread also does the unmount, and libsystemd (choco-technologies/dmsystem#9, #10) hears it there: it runs the
removeunits of its rules (devscan, up to 20 s each) and stops the units that came from the file system (the car HMI demo: ~4 s), each with its own timeout. Withstop_timeout_ms=5000automount was killed in the middle of the unmount: on the board the card stayed mounted, theservice stoptook 85-105 s and units were started again.stop_timeout_ms=60000; with it, unmounting a card with the car HMI running completes (25 s on the board, no hang).Needed by choco-technologies/dmod-boot#148 (do not merge that before a release with this).
🤖 Generated with Claude Code