[tpop3d-discuss] Tpop3d over NFS with Maildir: New mail files not immeditately seen?

Chris Lightfoot chris at ex-parrot.com
Thu, 21 Nov 2002 09:36:19 +0000

On Wed, Nov 20, 2002 at 05:38:48PM -0800, Rich, WhidbeyNet NOC wrote:
> Hi all,
> We're testing Tpop3d 1.4.2 on a Solaris 8 machine, with standard
> Maildirs, over NFS, using PAM for authentication. It works great so far,
> except one problem.
> When new mail arrives in "Maildir/new", either from Qmail, Exim or by
> manually creating a file, it takes 3 minutes for Tpop3d to recognized
> it. If you connect to Tpop3d within 3 minutes since the file was
> created, it reports "You have no messages at all", or, shows however
> many messages you had before the new mail arrived. Debug just shows:
> maildir_new: scanned maildir /var/mail/username/Maildir (0 messages) in
> 0.003s

> The problem also does not happen with qmail-pop3d in the same scenario
> (Solaris with Maildirs over NFS, using Qmail and Exim MTAs).


When tpop3d scans a maildir, it doesn't index messages
which were created after it started scanning it. I'm not
sure whether this check is necessary, in fact. A possible
problem which would give the behaviour you observe is if
the machine running tpop3d and the machine running the MDA
have a clock difference of three minutes, but other than
that, I'm not sure I can see what's going on here.

You could try removing the created-before check, with this

--- maildir.c   13 Nov 2002 20:08:59 -0000      1.13
+++ maildir.c   21 Nov 2002 09:35:46 -0000
@@ -83,7 +83,7 @@
         filename = xmalloc(strlen(subdir) + strlen(d->d_name) + 2);
         sprintf(filename, "%s/%s", subdir, d->d_name);
         if (!filename) return -1;
-        if (stat(filename, &st) == 0 && st.st_mtime < time) {
+        if (stat(filename, &st) == 0) { /* && st.st_mtime < time) { */
             /* These get sorted by mtime later. */
             struct indexpoint pt;
             maildir_make_indexpoint(&pt, filename, st.st_size, st.st_mtime);

> This issue happens no matter what locking mechanism is enabled/disabled
> in Tpop3d. Tpop doesn't try to lock Maildirs does it?


``This then, was the apex of Soviet 1960's electronic...
  or at least electric, design-- a safety system that both
  causes, and worsens, disasters.'' (Ami Silberman, on Soviet moon rockets)