Subject: bug#36714: 27.0.50; Gnus nnmaildir taking long time to recursively visit sub-Maildirs

From: Eric Abrahamsen <[email-masked]>
Date: Thu, 18 Jul 2019 12:00:25 -0700

Jean Louis <[email-masked]> writes:

> Hello,
>
> I am using Maildirs on my system. And I have 47682 various maildirs,
> each belong to one email in the ordered way like:
>
> ~/Maildir/[email-masked]
> ~/Maildir/[email-masked]
> ~/Maildir/[email-masked]
> ~/Maildir/[email-masked]
>
> and so on.
>
> Gnus offers nice interface and functions which I would like to use
> while reading email. Even though I like MH-E and Rmail more, they both
> do not offer Maildir support.
>
> I have made settings as following.
>
> '(gnus-secondary-select-methods
>    '((nnmaildir ""
> 	(directory "/home/data1/protected/Maildir/"))))
> 	
>  '(gnus-select-method '(nnimap "my.imap"))
>
> Now, I do not need to susbcribe to 47682 Maildirs at once, as under
> ~/Maildir I have cur, new, tmp and that is the Maildir I would like to
> read as only one.
>
> However, after setting the above, Gnus started doing something since
> yesterday, and I still do not know what it is, it is maybe indexing or
> setting up something, I do not know, process is still running for many
> hours.
>
> I think that this is bug.
>
> What I think is that Gnus is now recursively visiting all Maildirs
> instead of using just the main one.

I think you're right, and in a sense it is definitely a bug, but a lot
of people have run into this and I've seen some saying "there's not much
to be done". So that didn't sound very encouraging.

Could you do M-x toggle-debug-on-quit, start up Gnus, let it hang for a
bit, then do "C-g" and post the resulting backtrace here? It's fairly
obvious what's going on, but it would be good to see the specifics.

The nnmaildir servers keep track of their directory modtime, which is
both set and read only once, in `nnmaildir-request-scan'. So at least it
should be fairly easy to see what's happening there. Gnus doesn't save
the modtimes, though -- perhaps a potential solution could involve
saving the maildir modtimes in newsrc.eld.

> And my other question is, is there a way to quickly access
> Maildir/[email-masked] by using Gnus? Some function maybe to just
> write the email address or fetch it from database, and to open the
> Maildir with nnmaildir?

I'm not entirely sure what you mean here, but one suggestion I have is
to create four different nnmaildir select methods, one for each of your
email addresses. I think that's how Gnus is expecting this sort of thing
to be set up, and it might make it easier for you to access, as well.

Eric