From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id EA6389142B
 for <pbs-devel@lists.proxmox.com>; Thu,  8 Sep 2022 09:08:52 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D9DA919631
 for <pbs-devel@lists.proxmox.com>; Thu,  8 Sep 2022 09:08:52 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Thu,  8 Sep 2022 09:08:52 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CB3DD44520;
 Thu,  8 Sep 2022 09:08:51 +0200 (CEST)
Message-ID: <87a756b4-ef3a-47c4-2219-df252b7cce9d@proxmox.com>
Date: Thu, 8 Sep 2022 09:08:50 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101
 Thunderbird/105.0
Content-Language: en-GB
To: Mark Schouten <mark@tuxis.nl>,
 Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
References: <emb468a227-f50d-49a8-92f2-1c3a0e7fa058@3a15c2fd.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <emb468a227-f50d-49a8-92f2-1c3a0e7fa058@3a15c2fd.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-LEVEL: Spam detection results:  0
 AWL 2.102 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -4.199 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [sysctl-explorer.net]
Subject: Re: [pbs-devel] Too many open files
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 08 Sep 2022 07:08:53 -0000

Hi,

Am 07/09/2022 um 14:02 schrieb Mark Schouten:
> On=C2=A0our=C2=A0shared=C2=A0PBS-server,=C2=A0on=C2=A0busy=C2=A0moments=
,=C2=A0we=C2=A0get=C2=A0the=C2=A0following=C2=A0error:
> Sep=C2=A0 7 00:00:35 pbs001 proxmox-backup-proxy[9288]: error accepting=
 tcp connection:=C2=A0Too=C2=A0many=C2=A0open=C2=A0files=C2=A0(os=C2=A0er=
ror=C2=A024)
>=20

How many FDs are open for the proxy?

ls -1 /proc/$(pidof proxmox-backup-proxy)/fd | wc -l

> This is a box with quite a lot of datastores, but looking at the open f=
iles=C2=A0setting:
> root@pbs001:/var/log#=C2=A0cat=C2=A0/proc/sys/fs/file-max
> 9223372036854775807

This is not the relevant limit though, this is the upper limit of the
kernel for file handles
https://sysctl-explorer.net/fs/filemax%20&%20filenr/

The per-process file (hard) limit would be:
https://sysctl-explorer.net/fs/nr_open/

And as that mentions, that again depends on the rlimit, check the default=
 (soft)
imits with

- as root:
  ulimit -a

- for the backup user
  su - backup -s /bin/bash -c "ulimit -n $[1024*1024]"


Or probably even easier, check the /proc entry of the proxy and api daemo=
ns:

cat /proc/$(pidof proxmox-backup-proxy)/limits
cat /proc/$(pidof proxmox-backup-api)/limits

>=20
> That=C2=A0should=C2=A0be=C2=A0enough.=C2=A0=F0=9F=98=84
>=20
> Does=C2=A0PBS=C2=A0itself=C2=A0limit=C2=A0the=C2=A0open=C2=A0files=C2=A0=
somewhere?

No, but it doesn't increase it's soft limit to the hard limit, something =
we
want to do in the future.

As workaround try increasing soft (and possible hard) limit for root and =
backup
user, you can do that by editing `/etc/security/limits.conf`, adding line=
s like:

backup soft nofile 524288
root soft nofile 524288

(should set soft to current hard limit)

Or alternatively use a systemd service override to make it really process=
 specific:

# systemctl edit proxmox-backup-proxy.service

There add a "[Service]" Section, if not already existing and a "LimitNOFI=
LE=3DX" below,
e.g.:
=20
[Service]
LimitNOFILE=3D524288

Save and close the editor and restart the service, then do the same for t=
he
proxmox-backup.service

As said, we plan to upper that soft limit too in the future.

cheers,
Thomas