Re: [Dovecot] mbox file too large error with deliver

2008-11-24 Thread Timo Sirainen
On Mon, 2008-11-24 at 19:13 +0200, Gokdeniz Karadag wrote:
> >> > fatal: main.cf configuration error: mailbox_size_limit is smaller  
> >> > than message_size_limit
> >> >
> >> > A limit of 2147483648 - 1 worked fine.
> >> >
> >> > There are two distinct bugs probably, one in postfix and one in  
> >> > dovecot.
> > 
> > Postfix clearly is using signed 32bit integer here, which could be  
> > considered a bug. But why do you think there's a bug in Dovecot? Note  
> > that Dovecot never even sees this value. It's the kernel that enforces  
> > it, Dovecot simply reacts to a write() failure.
> 
> The logs stating the "File too large" errors belong to dovecot's deliver
> process. While I was searching for a solution, I read that deliver honors
> mailbox_size_limit setting of postfix, I'm not sure if that is correct or not.

It's kind of correct, but not really. What happens is:

1. Postfix reads the mailbox_size_limit setting.

2. Based on the setting Postfix calls setrlimit(RLIMIT_FSIZE) function
to tell kernel the maximum file size for the process and child
processes. This is similar to running "ulimit -f mailbox_size_limit" on
shell before running deliver.

3. Postfix executes deliver. deliver is in no way aware of the
mailbox_size_limit setting or that there is any kind of a limit. It
simply tries to write to a file, which fails with EFBIG.

> If postfix sets file size limit with ulimit before execing deliver, OR uses a
> similar process which is out of deliver's control, then there is nothing
> concerning dovecot. If someone can clarify the issue I would be happy.

Yes, this is the case.


signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] mbox file too large error with deliver

2008-11-24 Thread Gokdeniz Karadag
> Timo Sirainen <[EMAIL PROTECTED]> wrote:
>> > Setting mailbox_size_limit to 0 made deliveries possible. a limit of  
>> > 20 (<2GB) also did not show the errors. Thank you ! :)
>> >
>> > My issue is fixed but deliver might have a bug, so I will explain  
>> > things, sorry for not being clear previously.
>> >
>> > Old mail server was 32 bit(an old version of debian) and used  
>> > procmail for deliveries, that setup worked with the given limit of  
>> > 5GB and mailbox sizes above 1GB.
>> >
>> > After migrating to an 64 bit server (debian etch) and dovecot's  
>> > deliver, the stated delivery errors appeared for mailboxes above 1  
>> > GB. As I stated at the beginning of my reply, setting  
>> > mailbox_size_limit below 2GB made deliveries possible. I tried with  
>> > edge values, mailbox_size_limit=2147483648 (exactly 2GB) would give  
>> > the following error in postfix logs:
>> >
>> > fatal: main.cf configuration error: mailbox_size_limit is smaller  
>> > than message_size_limit
>> >
>> > A limit of 2147483648 - 1 worked fine.
>> >
>> > There are two distinct bugs probably, one in postfix and one in  
>> > dovecot.
> 
> Postfix clearly is using signed 32bit integer here, which could be  
> considered a bug. But why do you think there's a bug in Dovecot? Note  
> that Dovecot never even sees this value. It's the kernel that enforces  
> it, Dovecot simply reacts to a write() failure.

The logs stating the "File too large" errors belong to dovecot's deliver
process. While I was searching for a solution, I read that deliver honors
mailbox_size_limit setting of postfix, I'm not sure if that is correct or not.

Note that the destination mailboxes are smaller than 2GB here, but still gets
"File too large" error. The machine is 64-bit, so no fs related kernel limits
on file size.

I have not dived into postfix and/or dovecot internals, but my guess is ,
dovecot gets the mailbox size limit and behaves accordingly. If that is the
case, the problem can be fixed in dovecot's deliver code.

If postfix sets file size limit with ulimit before execing deliver, OR uses a
similar process which is out of deliver's control, then there is nothing
concerning dovecot. If someone can clarify the issue I would be happy.

-- 
Gokdeniz Karadag



Re: [Dovecot] mbox file too large error with deliver

2008-11-23 Thread Timo Sirainen
On Sun, 2008-11-23 at 23:55 +0200, Gokdeniz Karadag wrote:
> The deliver binary cannot deliver to large mailboxes. I cannot state an exact 
> size limit but mbox mailboxes above 1GB seem to be affected.
> 
> I have these in in postfix/main.cf
> mailbox_command = /usr/lib/dovecot/deliver
> mailbox_size_limit = 512000

So this is 5 GB. I don't know how exactly the limits work with 32 bit
systems, but if you get the error with >1 GB files then my guess is that
this 5 GB gets wrapped to 1 GB (5 mod 4 = 1).

> user.log.3.gz:Nov  8 21:23:01 guvercin deliver(dummy): write() failed with 
> mbox 
> file /var/mail/dummy: File too large

Kernel gives this error when it reaches the maximum file size limit.

If you don't want a limit, just set mailbox_size_limit = 0.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] mbox file too large error with deliver

2008-11-23 Thread Seth Mattinen

Gokdeniz Karadag wrote:

Hi,

I am using dovecot on debian, with version 1.0.rc15-2etch4. Along with 
postfix.


The deliver binary cannot deliver to large mailboxes. I cannot state an 
exact size limit but mbox mailboxes above 1GB seem to be affected.


I have these in in postfix/main.cf
mailbox_command = /usr/lib/dovecot/deliver
mailbox_size_limit = 512000

The user.log file shows these (I believe if no logging is specified, 
deliver binary tries to log with "logger" and they go to user ?)


user.log.3.gz:Nov  8 21:23:01 guvercin deliver(dummy): write() failed 
with mbox file /var/mail/dummy: File too large
user.log.3.gz:Nov  8 21:23:01 guvercin deliver(dummy): 
msgid=<[EMAIL PROTECTED]>: save failed to INBOX
user.log.3.gz:Nov  8 21:23:01 guvercin deliver(dummy): sieve runtime 
error: Keep: Generic Error


The /var/mail/dummy file exists and is 1.9GB, so my filesystem certainly 
supports files >1G


What may be the problem ?



The limit you're probably thinking of is 2G (not 1G), if it applies to 
your particular OS. On a 32 bit system without large file support 
treating sizes as a signed integer, 2^31 bytes is 2 gigs.


~Seth


Re: [Dovecot] mbox file too large error with deliver

2008-11-23 Thread Charles Marcus
On 11/23/2008, Gokdeniz Karadag ([EMAIL PROTECTED]) wrote:
> dovecot -n output follows :
> 
> 
> log_timestamp: %Y-%m-%d %H:%M:%S 

Either this is an old version or you snipped the version from the top of
the dovecot -n output...

What version of dovecot?

Also, OS/version info may help too...

-- 

Best regards,

Charles