Hello, I've been a happy mpd user for years now. Recently however, I have regularly been losing my playlist when I forgot to close mpd manually before rebooting.
The reason behind this is undoubtedly systemd, which TERMs and KILLs mpd quite fast in succession, revealing the race condition. The state file is truncated, but not yet written to. The solution would be to make mpd immune to race conditions, just like many other applications. [1] We need to create a temporary file (next to the file we want to replace, on the same filesystem). And with the rename() syscall, we replace the old file atomically with the new one. This is guaranteed to result in either the old or the new file being in place, instead of outright data loss. I wonder whether to implement this in src/StateFile.cxx or src/fs/io/FileOutputStream.cxx. If somebody could hint me on how to structure this, or directly implement the change, I'd be very grateful. Cheers [1] https://trac.gajim.org/ticket/8092#comment:1 _______________________________________________ mpd-devel mailing list [email protected] http://mailman.blarg.de/listinfo/mpd-devel
