Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Too many open files

20 views
Skip to first unread message

Alex

unread,
Dec 14, 2015, 11:32:48 AM12/14/15
to
Hi,

I'm using amavisd-new-2.10.1 on fedora22 and occasionally receive "too
many open files" where it's necessary to just restart amavisd to get
it going again.

837D0346927 2973 Sun Dec 13 23:11:20 donot...@nexusworldservices.com
(host 127.0.0.1[127.0.0.1] said: 451 4.5.0 Error in processing,
id=25071-05-40, check_init2 FAILED: Could not open /etc/resolv.conf:
Too many open files at /usr/sbin/amavisd line 17747. (in reply to end
of DATA command))

I've search around quite a bit, and the only suggestions I see are to
use ulimit to increase it. This won't survive a reboot, so I wondered
how to do it at the system level instead?

Will this even fix the problem? I notice now amavisd is using quite a
few more than the normal 1024 limit already:

# lsof |grep amavis|wc -l
1772

# ulimit -n
1024

Is this a PAM setting that I must change?

Any help greatly appreciated.
Thanks,
Alex

Alex JOST

unread,
Dec 14, 2015, 12:17:56 PM12/14/15
to
Fedora uses systemd which sets the limits per service. You need to
override the default service. This should work:

mkdir /etc/systemd/system/amavisd.service.d
cd /etc/systemd/system/amavisd.service.d
echo -e "[Service]\nLimitNOFILE=5000" > 10-limits.conf
systemctl daemon-reload


--
Alex JOST

Pete Houston

unread,
Dec 14, 2015, 12:30:47 PM12/14/15
to
On Mon, Dec 14, 2015 at 11:51:24AM -0500, Alex wrote:
> On Mon, Dec 14, 2015 at 11:39 AM, Pete Houston <p...@openstrike.co.uk> wrote:
> > See the man page for limits.conf for setting persistent limits.
>
> Pete, thanks very much. Any idea why the system already appears to
> have more than the maximum number of open files (1024) according to
> lsof for the amavis user?

In your previous message you determined the number like this:

# lsof |grep amavis|wc -l
1772

which is too crude - it can include files opened by other users which
have "amavis" in the path, for example.

> Also, what is the difference between setting it in limits.conf and
> setting it with sysctl?
>
> sysctl says the number of open files is much larger:
>
> # sysctl fs.file-max
> fs.file-max = 3288819
>
> Is that for the whole system, and ulimit is per-process? Or per-user?

sysctl fs.file-max is the maximum across the whole system - you shouldn't
need to touch that. ulimit sets values in the current shell and processes
forked from it.

Pete
--
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036

Alex

unread,
Dec 14, 2015, 3:41:50 PM12/14/15
to
On Mon, Dec 14, 2015 at 11:39 AM, Pete Houston <p...@openstrike.co.uk> wrote:
> See the man page for limits.conf for setting persistent limits.

Pete, thanks very much. Any idea why the system already appears to
have more than the maximum number of open files (1024) according to
lsof for the amavis user?

Also, what is the difference between setting it in limits.conf and
setting it with sysctl?

sysctl says the number of open files is much larger:

# sysctl fs.file-max
fs.file-max = 3288819

Is that for the whole system, and ulimit is per-process? Or per-user?

Also, should this happen under normal circumstances? Is it possible
that amavisd is not managing file descriptors correctly and perhaps
using too many, or not closing them after use?

Thanks,
Alex

On Mon, Dec 14, 2015 at 11:39 AM, Pete Houston <p...@openstrike.co.uk> wrote:
> On Mon, Dec 14, 2015 at 11:31:57AM -0500, Alex wrote:
>> I've search around quite a bit, and the only suggestions I see are to
>> use ulimit to increase it. This won't survive a reboot, so I wondered
>> how to do it at the system level instead?
>
> See the man page for limits.conf for setting persistent limits.
>

Alex

unread,
Dec 14, 2015, 8:26:38 PM12/14/15
to
Hi,

> Fedora uses systemd which sets the limits per service. You need to override
> the default service. This should work:
>
> mkdir /etc/systemd/system/amavisd.service.d
> cd /etc/systemd/system/amavisd.service.d
> echo -e "[Service]\nLimitNOFILE=5000" > 10-limits.conf
> systemctl daemon-reload

Ah, terrific. Where did you find that LimitNOFILE was the option that
controls the number of open files? Where are those options defined?

Thanks guys for your help.

Thanks,
Alex

Juan Orti Alcaine

unread,
Dec 15, 2015, 4:03:29 AM12/15/15
to
2015-12-14 18:07 GMT+01:00 Alex JOST <jost+...@dimejo.at>:
> Am 14.12.2015 um 17:31 schrieb Alex:
> Fedora uses systemd which sets the limits per service. You need to override
> the default service. This should work:
>
> mkdir /etc/systemd/system/amavisd.service.d
> cd /etc/systemd/system/amavisd.service.d
> echo -e "[Service]\nLimitNOFILE=5000" > 10-limits.conf
> systemctl daemon-reload

Or just:
systemctl edit amavisd.service

[Service]
LimitNOFILE=5000

--
Juan Orti
https://apuntesderootblog.wordpress.com/

0 new messages