
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Aug 5, 2008, at 7:34 PM, Mark Sapiro wrote:
I think I see the problem. It is related to qrunner list caching and the fact the there is insufficient precision in the list instance's __timestamp
The scenario is the following
add_member saves the list with the first member.
VirginRunner gets there first, instantiates and caches the list. It then locks the list, processes the welcome and saves and unlocks the list.
add_member gets the lock, adds the second member and saves the
list.Virgin runner gets the second welcome. The list is cached, so it uses the cached instance. It then locks the list which ultimately calls MailList.__load() to refresh the list data, but __load() does
mtime = os.path.getmtime(dbfile) if mtime <= self.__timestamp: # File is not newer return None, None
The problem is os.path.getmtime() returns a time in seconds so if we are still in the same second as step 2), we don't refresh the list.
Thank you very much Max for providing a script to reproduce the
problem.I'm not sure of the best solution. I'm leaning towards dropping the __timestamp test or perhaps replacing it with a file size test, but that too may be unreliable.
I wonder if the list cache is still worth it? I've run into trouble
with it in the recent past and I suspect that whatever benefits we got
from it in ancient times, may not be so relevant today. My first
inclination would be to ditch the cache, but that may not completely
solve this issue (ah, for the backing of a real database!).
Ultimately the timestamp check probably has to go. If we try to load
the list, we should just load it and not try to be so fancy to avoid
reading from disk. Yes, it means more I/O but reliability is more
important, IMO. I'm not convinced a size check is worth it.
- -Barry
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin)
iEYEARECAAYFAkiY+qMACgkQ2YZpQepbvXHUbgCfeWIwkAjv/9wYpJa9vQ16dwCP jYIAn0wVNl3JXm+9R2LJ5AUa46FwhNAN =P5Yo -----END PGP SIGNATURE-----