From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-user+bounces-199606-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id D5659158094
	for <garchives@archives.gentoo.org>; Thu,  8 Sep 2022 17:21:34 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7840FE0BA0;
	Thu,  8 Sep 2022 17:19:45 +0000 (UTC)
Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 9BAF9E0A9E
	for <gentoo-user@lists.gentoo.org>; Thu,  8 Sep 2022 17:19:44 +0000 (UTC)
Received: by mail-lj1-x22c.google.com with SMTP id y18so5986825ljh.12
        for <gentoo-user@lists.gentoo.org>; Thu, 08 Sep 2022 10:19:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20210112;
        h=in-reply-to:content-disposition:mime-version:references
         :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject
         :date;
        bh=KpllCC2k4gMNsrz99qr54vm+L0hIyLWjwxlocJqxHDE=;
        b=e/OhtbZeunedc2rLNajx0ZYfMim3uX/W+wXjfiWzoAnWzWuMez80HNohB36ZnKqUBU
         9ay8bEKX2qJit5K/ZipTObsWiXp7TenOuaYEgVjC4HGvEZ6mSf7Pk/1eQ5yr0wd1Nog4
         7TRBP6HjQGrvqKsvcmdFL/Mk7dV2bVPJ0F5ym2UPmTFxOgKb3eDR+3zHBvcKMS3xFIAX
         MPxpIp585HG5i9CaDb4ALbxY2q7wC/DLB+olOGOSBv8gekCZ1DCDVyktMK8o4Z2k1912
         1nIWbN3F8ERtFgkLkVdfU0adLoiEMx6vDZLu17g+vOVD8WuIjS6llJD1ck81WJTtrRd9
         PO4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        h=in-reply-to:content-disposition:mime-version:references
         :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state
         :from:to:cc:subject:date;
        bh=KpllCC2k4gMNsrz99qr54vm+L0hIyLWjwxlocJqxHDE=;
        b=gs/ol2aDXaGKD7RDTeKwe4cgGkHPHkJ29DkkN2CTxm688eyS44eNxGV2Bo3V16rqta
         hJ8qoLhp5CHSWNhLh3S/UxkWrJmse5vwWJCIFowWAKb+m3BNGVkpEgC0ifDAJAEBKIRw
         EXAaahypAmpdj5M7hD2D+QbFmO7T9MAZS24bo2OOfUKiFPk3jisFGqLc8Kmm3KwsrzRy
         YPIS1WHmHR+1cd5AifSvtGxxbXMJ1SPVFU//Yrjdy3xME/nIUQ1q3iht1kwdWkM/G1M3
         OkzxWZAQoJxVaNC8wcrBBrj1Kd5/gCY6kGrUSzpL8qIPX/CMvHeKWgJQIGJtinBG8YGL
         6hmQ==
X-Gm-Message-State: ACgBeo0GsUstHVXUXBxwDaicngXHAHocl5c+rUVxeDcawKicSSRS77W2
	5JHaW81y0XYCCPRt/xI2lEkGslGHDGc=
X-Google-Smtp-Source: AA6agR7JhXTxfIIx11/WPWZLNq/PJUs5HOlRu+kZ5TXLdxJKtU/6wxUP8jWR06KGTJnheJe/OmuIfw==
X-Received: by 2002:a05:651c:2112:b0:261:b9c1:509 with SMTP id a18-20020a05651c211200b00261b9c10509mr2962844ljq.39.1662657583262;
        Thu, 08 Sep 2022 10:19:43 -0700 (PDT)
Received: from localhost ([176.111.230.96])
        by smtp.gmail.com with ESMTPSA id r7-20020ac25f87000000b00492c017de43sm3111428lfe.127.2022.09.08.10.19.42
        for <gentoo-user@lists.gentoo.org>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 08 Sep 2022 10:19:42 -0700 (PDT)
Date: Thu, 8 Sep 2022 19:19:40 +0200
From: Mateusz Okulus <mmokulus@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] qbittorrent crashes after to many files open error
Message-ID: <20220908171940.3vgteruwtka6mnie@archlinux>
Mail-Followup-To: gentoo-user@lists.gentoo.org
References: <d7586cf9-ecf4-1853-1ae5-4e251b791331@gmail.com>
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <d7586cf9-ecf4-1853-1ae5-4e251b791331@gmail.com>
X-Archives-Salt: 21fa3b0e-e2c9-41e1-b353-4863d49ed93a
X-Archives-Hash: 5a015732e1607f7175acff2e960b5cd5

> root@fireball / # sysctl fs.file-max
> fs.file-max = 3289952
> root@fireball / # sysctl -w fs.file-max=32899520
> fs.file-max = 32899520
> root@fireball / # cat /proc/sys/fs/file-max
> 32899520

On my pc the limit is 2^63. But this is max files for kernel, which is
different for max files per user and max files per process.

For example if I run:

$ grep 'Limit\|open' /proc/$(pgrep qbittorrent | head -1)/limits
Limit                     Soft Limit           Hard Limit           Units
Max open files            524288               524288               files

524288 = 2^19

QBittorrent increases it's process limit to hard limit. With 10 TB of
torrents it's hard to tell if it's a bug or just 500k files is not
enough, I'd say it's probably the latter.

It seems you can change the default hard limit in
/etc/security/limits.conf

For example:

# 2^24, increased from 2^19
* hard nofile 16777216

Then after reloging:

$ grep 'Limit\|open' /proc/$(pgrep qbittorrent | head -1)/limits
Limit                     Soft Limit           Hard Limit           Units
Max open files            16777216             16777216             files

So this works, at least for me.

Check also limits.conf man page.

Regards,
mmokulus