aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <msapiro@value.net>2011-09-29 16:39:46 -0700
committerMark Sapiro <msapiro@value.net>2011-09-29 16:39:46 -0700
commitbeb580502a8dc928b0ca3fe35f36be9cf89ab9e1 (patch)
tree8684edace180fc51830eccbc353b751d344504b7 /Mailman
parent37d138d14ad6dfcae2130cbec74e78ff0ef6f17a (diff)
downloadmailman2-beb580502a8dc928b0ca3fe35f36be9cf89ab9e1.tar.gz
mailman2-beb580502a8dc928b0ca3fe35f36be9cf89ab9e1.tar.xz
mailman2-beb580502a8dc928b0ca3fe35f36be9cf89ab9e1.zip
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.
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/MailList.py15
1 files changed, 12 insertions, 3 deletions
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):