message_size_limit, queue_minfree, and mail spool not on root directory

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

message_size_limit, queue_minfree, and mail spool not on root directory

W. Michael Petullo
My mail spool is not on my root directory:

data_directory = /mnt/xvdb/var/lib/postfix
mail_spool_directory = /mnt/xvdb/var/spool/mail
queue_directory = /mnt/xvdb/var/spool/postfix
virtual_mailbox_base = /mnt/xvdb/var/spool/mail

However, it seems that the capacity of my root mount has some bearing
on the evaluation of Postfix's message_size_limit and queue_minfree. I
am getting "insufficient system storage" errors despite having enough
space in /mnt/xvdb. I have much less space available on /.

I found some relevant functions in Postfix: fsspace() and
smtpd_check_queue(). I also wrote a program confirming my understanding
of fsspace()'s use of statfs().

Before I continue diving into Postfix's source code, can someone provide
some information about the details surrounding message_size_limit and
queue_minfree? Is my assumption valid that the capacity of / should be
irrelevant when my spool is on /mnt/xvdb? Is there another directory I
should be concerned about other than the four listed above?

--
Mike

:wq
Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

Wietse Venema
W. Michael Petullo:

> My mail spool is not on my root directory:
>
> data_directory = /mnt/xvdb/var/lib/postfix
> mail_spool_directory = /mnt/xvdb/var/spool/mail
> queue_directory = /mnt/xvdb/var/spool/postfix
> virtual_mailbox_base = /mnt/xvdb/var/spool/mail
>
> However, it seems that the capacity of my root mount has some bearing
> on the evaluation of Postfix's message_size_limit and queue_minfree. I
> am getting "insufficient system storage" errors despite having enough
> space in /mnt/xvdb. I have much less space available on /.
>
> I found some relevant functions in Postfix: fsspace() and
> smtpd_check_queue(). I also wrote a program confirming my understanding
> of fsspace()'s use of statfs().
>
> Before I continue diving into Postfix's source code, can someone provide
> some information about the details surrounding message_size_limit and
> queue_minfree? Is my assumption valid that the capacity of / should be
> irrelevant when my spool is on /mnt/xvdb? Is there another directory I
> should be concerned about other than the four listed above?

If in doubt, RTFM?

queue_minfree (default: 0)
       The minimal amount of free space in bytes in the queue file system that
       is needed to receive mail.  This is currently used by the Postfix  SMTP
       server to decide if it will accept any mail at all.

       By default, the Postfix SMTP server rejects MAIL FROM commands when the
       amount of free space is less than 1.5*$message_size_limit (Postfix ver-
       sion  2.1  and  later).   To specify a higher minimum free space limit,
       specify a queue_minfree value that is at least 1.5*$message_size_limit.
Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

W. Michael Petullo
>> My mail spool is not on my root directory:
>>
>> data_directory = /mnt/xvdb/var/lib/postfix
>> mail_spool_directory = /mnt/xvdb/var/spool/mail
>> queue_directory = /mnt/xvdb/var/spool/postfix
>> virtual_mailbox_base = /mnt/xvdb/var/spool/mail
>>
>> However, it seems that the capacity of my root mount has some bearing
>> on the evaluation of Postfix's message_size_limit and queue_minfree. I
>> am getting "insufficient system storage" errors despite having enough
>> space in /mnt/xvdb. I have much less space available on /.
>>
>> I found some relevant functions in Postfix: fsspace() and
>> smtpd_check_queue(). I also wrote a program confirming my understanding
>> of fsspace()'s use of statfs().
>>
>> Before I continue diving into Postfix's source code, can someone provide
>> some information about the details surrounding message_size_limit and
>> queue_minfree? Is my assumption valid that the capacity of / should be
>> irrelevant when my spool is on /mnt/xvdb? Is there another directory I
>> should be concerned about other than the four listed above?
 

> If in doubt, RTFM?
>
> queue_minfree (default: 0)
>        The minimal amount of free space in bytes in the queue file system that
>        is needed to receive mail.  This is currently used by the Postfix  SMTP
>        server to decide if it will accept any mail at all.
>
>        By default, the Postfix SMTP server rejects MAIL FROM commands when the
>        amount of free space is less than 1.5*$message_size_limit (Postfix ver-
>        sion  2.1  and  later).   To specify a higher minimum free space limit,
>        specify a queue_minfree value that is at least 1.5*$message_size_limit.

I did indeed read that. What puzzles me is that it seems my spool
filesystem seems to have plenty of space. My root filesystem does not,
but as I understand things that should not matter.

--
Mike

:wq
Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

Viktor Dukhovni
In reply to this post by W. Michael Petullo
> On Sep 10, 2019, at 4:46 PM, W. Michael Petullo <[hidden email]> wrote:
>
> However, it seems that the capacity of my root mount has some bearing
> on the evaluation of Postfix's message_size_limit and queue_minfree. I
> am getting "insufficient system storage" errors despite having enough
> space in /mnt/xvdb. I have much less space available on /.

You won't get much help with "...it seems...".  For concrete help,
post actual facts (logs and configuration), rather than reinterpret
them in ways that likely obscure crucial details.

--
        Viktor.

Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

Wietse Venema
In reply to this post by W. Michael Petullo
W. Michael Petullo:

> > If in doubt, RTFM?
> >
> > queue_minfree (default: 0)
> >        The minimal amount of free space in bytes in the queue file system that
> >        is needed to receive mail.  This is currently used by the Postfix  SMTP
> >        server to decide if it will accept any mail at all.
> >
> >        By default, the Postfix SMTP server rejects MAIL FROM commands when the
> >        amount of free space is less than 1.5*$message_size_limit (Postfix ver-
> >        sion  2.1  and  later).   To specify a higher minimum free space limit,
> >        specify a queue_minfree value that is at least 1.5*$message_size_limit.
>
> I did indeed read that. What puzzles me is that it seems my spool
> filesystem seems to have plenty of space. My root filesystem does not,
> but as I understand things that should not matter.

What is the output from

        df -k
        postconf queue_directory message_size_limit queue_minfree

on the Postfix machine?

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

W. Michael Petullo
>>> If in doubt, RTFM?
>>>
>>> queue_minfree (default: 0)
>>>        The minimal amount of free space in bytes in the queue file system that
>>>        is needed to receive mail.  This is currently used by the Postfix  SMTP
>>>        server to decide if it will accept any mail at all.
>>>
>>>        By default, the Postfix SMTP server rejects MAIL FROM commands when the
>>>        amount of free space is less than 1.5*$message_size_limit (Postfix ver-
>>>        sion  2.1  and  later).   To specify a higher minimum free space limit,
>>>        specify a queue_minfree value that is at least 1.5*$message_size_limit.

>> I did indeed read that. What puzzles me is that it seems my spool
>> filesystem seems to have plenty of space. My root filesystem does not,
>> but as I understand things that should not matter.

> What is the output from
>
> df -k
> postconf queue_directory message_size_limit queue_minfree
>
> on the Postfix machine?

I found the source of the problem. What I did not realize is that the
OpenWrt package I use is patched to modify the call of fsspace() in
smtpd_check.c (I had been looking through the upstream source).

The OpenWrt patch hard codes fsspace("/overlay", &fsbuf), because
OpenWrt installations often make use of an overlay filesystems, mounted at
"/overlay". This makes sense in some cases, but obviously not when the
mail queue exists on a big, separate disk.

I suspect that this patch should be modified to be more careful, and I
also think its likely best kept as a per-distribution modification. The
reason I say this is that the layout of things, including the /overlay
mount point is distribution-specific. Thus a more robust logic is
required, but it probably belongs in a distribution-specific patch.

I wanted to follow up because it is possible that someone else might
run into this problem. I also wondered if there was an opinion in the
Postfix community about where to handle this edge case.

For further reference, here is an issue I submitted against the OpenWrt
Postfix package:

https://github.com/openwrt/packages/issues/9970

--
Mike

:wq
Reply | Threaded
Open this post in threaded view
|

Re: message_size_limit, queue_minfree, and mail spool not on root directory

Wietse Venema
W. Michael Petullo:
> The OpenWrt patch hard codes fsspace("/overlay", &fsbuf), because
> OpenWrt installations often make use of an overlay filesystems, mounted at
> "/overlay". This makes sense in some cases, but obviously not when the
> mail queue exists on a big, separate disk.

Lesson learned: avoid 'dirty hack' solutions.

        Wietse