Prasad Pandit <ppan...@redhat.com> writes: > On Mon, 10 Mar 2025 at 20:09, Fabiano Rosas <faro...@suse.de> wrote: >> Good point. Shutdown at random places makes it difficult to protect >> against cleanup races. > > * Just to understand, how and where do these races occur? >
They occur when cleanup code is allowed to run when resources have not yet been allocated or while the resources are still being accessed. Having the shutdown routine at a single point when it's clear everything else is ready for shutdown helps not only to avoid those issues, but also when investigating them. Otherwise you'll have the same code running at (potentially) completely different points in time and one of those times the system might be in an unexpected state.