[Dovecot] attachments not with email causing FETCH BODY[] failed

Anand Kumria wildfire at progsoc.org
Mon Aug 5 21:38:42 EEST 2013


Hi Timo,

On 5 August 2013 19:19, Timo Sirainen <tss at iki.fi> wrote:

> On 21.7.2013, at 17.12, Anand Kumria <wildfire at progsoc.org> wrote:
>
> > Anyone else experiencing this (Dovecot 2.2.4, attachments stored
> > separately):
> >
> > dovecot: imap(user at kamdha.com): Error: file_istream.open(/home/
> >
> example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718-a52388285a04eb51820c0000d485234e-c92f64f79f0d1ed01e6d5b314f04886c-42501
> )
> > failed: No such file or directory
> > dovecot: imap(user at example.com): Error: read(BODY[]) failed: No such
> file
> > or directory (FETCH  for mailbox INBOX UID 42501)
> > dovecot: imap(user at example.com): Disconnected: FETCH failed in=186
> out=86389
>
> I can think of one reason why this would happen that doesn't involve an
> actual Dovecot bug:
>
> First session starts fetching the message. It manages to open the sdbox
> file. Another sesssion deletes the mail and the attachment. The first
> session can still read the sdbox file, but can't access the attachment. But
> unless you were stress testing, this is quite unlikely.
>
> > - how might this occurred?
> > - what is the best way to find the corrupted message?
> > - how should I go about fixing this?
>
> I'd also like to know how it could have happened (other than accidental rm
> -rf). You could also later try again to read the mail, for example:
>

I actually have to make an effort to get access to the box, so it wasn't
anything on the command line.


>
> doveadm fetch -u user at kamdha.com text mailbox inbox uid 42501
>
> Does that fail with the same error?


Yes.


> Do you see anything with:
>
> ls /home/
> example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718*
>
>
>
No

I did some further analysis and after learning how 'doveadm fetch' works,
all the problem messages have a common problem.

Basically it appears that I configured:

  userA at example.com

and

 userA at kamdha.com

to *both* have the same storage location.

 i.e. /home/kamdha/com/user

And the 'mail_location' variable is set to 'sdbox:~/mail'

*AND* 'mail_attachment_dir' is specified as '/home/%d/%u/attachments'.

The primary domain is kamdha.com; all of the problem messages are addressed
to userA at example.com.

So if something was sent to userA at example.com it would wind up in /home/
example.com/userA/..../ but the mail in /home/kamdha.com/userA would
reference a location that it didn't know about.

My read of things was that '~' is *ONLY* valid in mail_location. If I could
specify mail_attachment_dir to be '~/attachments', then things should work.

Is my read of things correct?

Thanks,
Anand


More information about the dovecot mailing list