Hello Mark

Disclaimer: long outdated code, with a long removed component....

That put aside, a minor file corruption escalating into a complete outage for 
all users is the kind of examples of why the MailDir implementation of James 
had been removed.

We do not have scripts to audit / fix the James maildir storage.

I'd be you I'd :

 - 1/ backup everything
 - 2/ backup the postmaster user folder separatly too
 - 3/ RM the postmaster folder
This one is likely corrupted, removing it might restore access to all users...
 - 4/ Maybe try to patch the maildir format for postmaster and add it back OR 
recreate all its folders then COPY the mails back to it....
 - 5/ once the storm is over, consider an upgrade for James. I would happily 
help you...

Good luck,

Best regards,

Benoit

-- 

Best regards,

Benoit TELLIER

General manager of Linagora VIETNAM.
Product owner for Team-Mail product.
Chairman of the Apache James project.

Mail: btell...@linagora.com
Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)


On Sep 7, 2024 11:55 PM, from Marc Chamberlin Hello, It's been awhile since I 
was last on this list looking for an
answer to a problem! That's because my Apache James 3.4 server has been
running well enough for quite awhile. But yesterday it suddenly failed 
and I need help to find a fix/solution.

I first noticed this problem when all users, myself included, started
getting errors such as what Thunderbird reports when attempting to fetch
email from the imap server -

> The current operation on '<account folder' did not succeed. The mail
> server for account marc@<mydomainname>.com responded: SELECT failed.
> No such mailbox. Since this is happening on both Windows and Linux
> systems, that places my suspicions on the James server itself.
>
Looking at the James wrapper.log file I see this error and stack
walkback occurring and repeating a lot -

> INFO | jvm 1 | 2024/09/07 13:59:29 | 2024-09-07 13:59:29,951 ERROR |
> org.apache.james.imap.processor.fetch.FetchProcessor | Fetch failed
> for mailbox 80f33e00-bf03-4de7-b9b5-a55c5c73262f and sequence-set
> [IdRange ( 1->9223372036854775807 )] INFO | jvm 1 | 2024/09/07
> 13:59:29 |
> org.apache.james.mailbox.exception.MailboxNotFoundException:
> #private:Postmaster@<mydomain>.com:INBOX can not be found INFO | jvm 1
> | 2024/09/07 13:59:29 | at
> org.apache.james.mailbox.maildir.MaildirStore.loadMailbox(MaildirStore.java:118)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.mailbox.maildir.mail.MaildirMailboxMapper.visitUsersForMailboxList(MaildirMailboxMapper.java:287)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.mailbox.maildir.mail.MaildirMailboxMapper.list(MaildirMailboxMapper.java:256)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.mailbox.maildir.mail.MaildirMailboxMapper.findMailboxById(MaildirMailboxMapper.java:115)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.mailbox.store.StoreMailboxManager.getMailbox(StoreMailboxManager.java:291)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.SelectedMailboxImpl.getPath(SelectedMailboxImpl.java:148)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.AbstractMailboxProcessor.getSelectedMailbox(AbstractMailboxProcessor.java:414)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.fetch.FetchProcessor.doProcess(FetchProcessor.java:75)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.fetch.FetchProcessor.doProcess(FetchProcessor.java:58)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:110)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.AbstractMailboxProcessor.process(AbstractMailboxProcessor.java:97)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:89)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:71)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:57)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:66)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.apache.james.imapserver.netty.ImapChannelUpstreamHandler.messageReceived(ImapChannelUpstreamHandler.java:196)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> INFO | jvm 1 | 2024/09/07 13:59:29 | at
> java.base/java.lang.Thread.run(Thread.java:829) INFO | jvm 1 |
> 2024/09/07 13:59:29 | 2024-09-07 13:59:29,954 INFO |
> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in
> IMAP-FETCH: 525 ms. INFO | jvm 1 | 2024/09/07 13:59:32 | 2024-09-07
> 13:59:32,060 INFO |
> org.apache.james.metrics.logger.DefaultMetricFactory | Time spent in
> IMAP-IDLE: 2 ms. 

Looking at the mail storage on the disk, I think the directory for
Postmaster is messed up -

> quasar:~ #ls
> /mail/apache-james/var/store/maildir/<mydomain>.com/Postmaster .Sent
All the other storage directories for different accounts have a
different set of files (but all similar to each other) This Postmaster
directory seems to be missing a lot of stuff.

I did run fsck.ext4 checks on the partition holding all of the mail
files and it didn't find anything wrong. So how do I fix this so that
the James server will be a happy camper again and fetch emails from the
imap server? Is there a way to manually fix this or a script perhaps
that will reconstruct damaged mail store directories?

Thanks in advance for your time and help! Marc..

Reply via email to