From beb580502a8dc928b0ca3fe35f36be9cf89ab9e1 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Thu, 29 Sep 2011 16:39:46 -0700 Subject: A problem with the logic avoiding unnecessarily reloading a current list object from the config.pck arises if the list is updated by another process within the same second that it was last read/written. That can cause the reading of latest version of the list to be skipped. This has been fixed. Bug #862675. --- Mailman/MailList.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Mailman') diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 504effa7..0e9ac390 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -599,8 +599,16 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, # file doesn't exist, we'll get an EnvironmentError with errno set # to ENOENT (EnvironmentError is the base class of IOError and # OSError). + # We test strictly less than here because the resolution is whole + # seconds and we have seen cases of the file being updated by + # another process in the same second. + # Even this is not sufficient in shared file system environments + # if there is time skew between servers. In those cases, the test + # could be + # if mtime + MAX_SKEW < self.__timestamp: + # or the "if ...: return" just deleted. mtime = os.path.getmtime(dbfile) - if mtime <= self.__timestamp: + if mtime < self.__timestamp: # File is not newer return None, None fp = open(dbfile) @@ -618,8 +626,9 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, return None, e finally: fp.close() - # Update timestamp - self.__timestamp = mtime + # Update the timestamp. We use current time here rather than mtime + # so the test above might succeed the next time. + self.__timestamp = int(time.time()) return dict, None def Load(self, check_version=True): -- cgit v1.2.3