[issue7360] [mailbox] race: mbox may lose data with concurrent access

Antoine Pitrou report at bugs.python.org
Thu Nov 19 17:52:20 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

> the mailbox._singlefileMailbox class is not safe with concurrent access,
> because mailbox._singlefileMailbox.flush() replaces the underlying file
> with a new copy by constructing a temporary file and then renaming it.
> This breaks all other class instances which have this mailbox open.

I don't think this class aims at being safe against concurrent access,
so having it fail loudly is a good thing.
Besides, the proposed cure (overwriting instead of renaming) looks worse
than the illness. The virtue of renaming is that it is atomic (on POSIX
systems at least), so you can't end up with a half-written mailbox if
there's a crash or an IO problem in the middle.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7360>
_______________________________________


More information about the Python-bugs-list mailing list