From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#40023: 26.3; Emacs crashes when creating process if many file handles are in use (e.g., when using ccls) Date: Thu, 12 Mar 2020 17:46:58 +0100 Message-ID: References: <865E1017-DFA9-495D-BCDA-70B46FE09A27@pirk.name> <83fteeamtd.fsf@gnu.org> <83d09hsj4k.fsf@gnu.org> <83a74lshc9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="49733"; mail-complaints-to="usenet@ciao.gmane.io" Cc: holger@pirk.name, 40023@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 12 18:04:25 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCRFw-000CoI-Oo for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 18:04:24 +0100 Original-Received: from localhost ([::1]:46004 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCRFv-0008D3-Lc for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Mar 2020 13:04:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36328) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCR07-0005eL-NO for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 12:48:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCR06-000652-Ao for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 12:48:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCR06-00064u-4E for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 12:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jCR06-00023B-1Z for bug-gnu-emacs@gnu.org; Thu, 12 Mar 2020 12:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Mar 2020 16:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40023 X-GNU-PR-Package: emacs Original-Received: via spool by 40023-submit@debbugs.gnu.org id=B40023.15840316297804 (code B ref 40023); Thu, 12 Mar 2020 16:48:01 +0000 Original-Received: (at 40023) by debbugs.gnu.org; 12 Mar 2020 16:47:09 +0000 Original-Received: from localhost ([127.0.0.1]:57743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCQzE-00021n-QP for submit@debbugs.gnu.org; Thu, 12 Mar 2020 12:47:09 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:37631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jCQzC-00021J-Np for 40023@debbugs.gnu.org; Thu, 12 Mar 2020 12:47:07 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id a141so7122192wme.2 for <40023@debbugs.gnu.org>; Thu, 12 Mar 2020 09:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=vii7t2oLTf9webGiTSlnqtMhmof9J7MZRWmzIPtAgqA=; b=QQS0bWM+eXXUuMI+drZsGYcV1eHWETucVVDG9ePEQFBm8oKicKM560nyDqktQcUN69 Of1JYM/6xhZCzMyQ1NzKEMOHoGBgg4SgWmlv9Yv4Qd0vFvuRSjJ//WBDw0qmPlG3dP8U lsm1WEe0E4TYSVz1ftkk3gLy3UltyHps9STW4rEDntV1uweh4DdnErPrUBcwjAI0VXyN XPiBCjPiA3MkyzGHf0XlYFUL9mJgMjZiNzvnTADQdIwMHjOoGKF5WTWlGwlPAZsHzAI7 MUpTxu92rg+g6eD6oBrsDN+pUes7TomMVa/d70y14cZxvAkgL5IjXDehy8ljL1v9vWcf 5gNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=vii7t2oLTf9webGiTSlnqtMhmof9J7MZRWmzIPtAgqA=; b=AQfyKUDccYYpLPTJ5x24/oVG8gSZNTzhsIea5vDFM352J9ORJBNG2qlFlyNLPpBtQ+ btOrJvMzqDqlxPGBTPU1VaKm+jw/FVkufYusm1ZXQO+zFEHxjhJvXa0HqCF9SEsjUrcA KTEU8NCntvttggNMXU2HNJZ0wgGQzGNfK8OWwa4SpN2IHdiYysF5iWZqVGlLIle6v7nP OPdac3uk5eNczp8QcJwjF4h/aLSCoxWpx//SzGQ4DIbNdx/lx3qNk2jxK/MZYUjbRGbP oQu408nmiFpLccpvAUgCLjPj9amTBE0QgwZ7hdGoNtqp8ylPRTPITxWwcqvFZwcjK3z4 fu+w== X-Gm-Message-State: ANhLgQ2rGG3v0dWlSttSvelj4rsb9vlHLu62GXbcRItMNu+ZPSTS0d77 wmelz//inxRw+XRZxxSlRP1cxds3IQM= X-Google-Smtp-Source: ADFU+vuSPIb5fDpk5VrEf3jr/ubBfI+ijICiMKm5uyTUv+d7MNh5xuaeMgkIESFxujb+Z6RwqN5hIw== X-Received: by 2002:a7b:cc9a:: with SMTP id p26mr5729155wma.0.1584031620331; Thu, 12 Mar 2020 09:47:00 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:9dd6:6e5d:c7e3:9cf4]) by smtp.gmail.com with ESMTPSA id f15sm59545038wru.83.2020.03.12.09.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 09:46:59 -0700 (PDT) In-Reply-To: <83a74lshc9.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 12 Mar 2020 17:50:14 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177228 Archived-At: >>>>> On Thu, 12 Mar 2020 17:50:14 +0200, Eli Zaretskii said: >> From: Robert Pluim >> Cc: holger@pirk.name, 40023@debbugs.gnu.org >> Date: Thu, 12 Mar 2020 16:24:44 +0100 >>=20 >> >> You mean Bug#39164? I don=CA=BCt think there was a commit for tha= t. >>=20 Eli> That's too bad. I think we should revive that bug and fix it in E= macs Eli> 27, since I understand the recent versions of macOS will have that Eli> effect more and more frequently. >>=20 >> If someone has an 'emacs -Q' testcase I can look at it. Soon we will >> all be spending lots of time at home here :-( Eli> We could simply install the proposed workaround on the emacs-27 br= anch Eli> for now, I think. Holger, is it possible for you to rebuild emacs with the following patch and see if Emacs still crashes? If it fixes things I=CA=BCll install to emacs-27 diff --git a/src/nsterm.m b/src/nsterm.m index aefbb2721e..90f63bc182 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -5805,6 +5805,22 @@ - (void)applicationDidFinishLaunching: (NSNotificati= on *)notification #endif =20 #ifdef NS_IMPL_COCOA + /* Some functions/methods in CoreFoundation/Foundation increase the + maximum number of open files for the process in their first call. + We make dummy calls to them and then reduce the resource limit + here, since pselect cannot handle file descriptors that are + greater than or equal to FD_SETSIZE. */ + CFSocketGetTypeID (); + CFFileDescriptorGetTypeID (); + [[NSFileHandle alloc] init]; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) =3D=3D 0 + && rlim.rlim_cur > FD_SETSIZE) + { + rlim.rlim_cur =3D FD_SETSIZE; + setrlimit (RLIMIT_NOFILE, &rlim); + } + if ([NSApp activationPolicy] =3D=3D NSApplicationActivationPolicyProhibi= ted) { /* Set the app's activation policy to regular when we run outside of a bundle. This is already done for us by Info.plist when we