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

2013-08-05 Thread Timo Sirainen
On 21.7.2013, at 17.12, Anand Kumria wildf...@progsoc.org wrote:

 Anyone else experiencing this (Dovecot 2.2.4, attachments stored
 separately):
 
 dovecot: imap(u...@kamdha.com): Error: file_istream.open(/home/
 example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718-a52388285a04eb51820cd485234e-c92f64f79f0d1ed01e6d5b314f04886c-42501)
 failed: No such file or directory
 dovecot: imap(u...@example.com): Error: read(BODY[]) failed: No such file
 or directory (FETCH  for mailbox INBOX UID 42501)
 dovecot: imap(u...@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:

doveadm fetch -u u...@kamdha.com text mailbox inbox uid 42501

Does that fail with the same error? Do you see anything with:

ls 
/home/example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718*



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

2013-08-05 Thread Anand Kumria
Hi Timo,

On 5 August 2013 19:19, Timo Sirainen t...@iki.fi wrote:

 On 21.7.2013, at 17.12, Anand Kumria wildf...@progsoc.org wrote:

  Anyone else experiencing this (Dovecot 2.2.4, attachments stored
  separately):
 
  dovecot: imap(u...@kamdha.com): Error: file_istream.open(/home/
 
 example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718-a52388285a04eb51820cd485234e-c92f64f79f0d1ed01e6d5b314f04886c-42501
 )
  failed: No such file or directory
  dovecot: imap(u...@example.com): Error: read(BODY[]) failed: No such
 file
  or directory (FETCH  for mailbox INBOX UID 42501)
  dovecot: imap(u...@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 u...@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:

  us...@example.com

and

 us...@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 us...@example.com.

So if something was sent to us...@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


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

2013-08-05 Thread Timo Sirainen
On 5.8.2013, at 21.38, Anand Kumria wildf...@progsoc.org wrote:

 Basically it appears that I configured:
 
  us...@example.com
 
 and
 
 us...@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 us...@example.com.
 
 So if something was sent to us...@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.

Ah, that explains it.

 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.

You can use %h/attachments.



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

2013-07-22 Thread Charles Marcus

On 2013-07-21 10:12 AM, Anand Kumria wildf...@progsoc.org wrote:

My dovecot.conf attachment related config is:


No, please don't provide copy/pastes of config files.

Always provide FULL doveconf -n output (and postfix -n output when it 
may be related to postfix)...



--

Best regards,

Charles




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

2013-07-21 Thread Anand Kumria
Hi,

Anyone else experiencing this (Dovecot 2.2.4, attachments stored
separately):

dovecot: imap(u...@kamdha.com): Error: file_istream.open(/home/
example.com/user/attachments/f5/f0/f5f0f2c08c4311fa404d090a703c3b492f2ea718-a52388285a04eb51820cd485234e-c92f64f79f0d1ed01e6d5b314f04886c-42501)
failed: No such file or directory
dovecot: imap(u...@example.com): Error: read(BODY[]) failed: No such file
or directory (FETCH  for mailbox INBOX UID 42501)
dovecot: imap(u...@example.com): Disconnected: FETCH failed in=186 out=86389

My dovecot.conf attachment related config is:

mail_attachment_dir = /home/%d/%n/attachments
mail_attachment_min_size = 128k
mail_attachment_fs = sis posix
mail_attachment_hash = %{sha1}

So, questions:

 - anyone else experiencing this?
 - how might this occurred?
 - what is the best way to find the corrupted message?
 - how should I go about fixing this?

Any help or pointers would be appreciated.

Thanks,
Anand