From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alexander Shukaev Newsgroups: gmane.emacs.devel Subject: Re: Emacs Hangs on Filesystem Operations on Stale NFS Date: Mon, 11 Jun 2018 14:11:45 +0200 Message-ID: <7466e2d177e79983436af2425ceb5b54@alexander.shukaev.name> References: <1727545582523435cab149c2bc857b40@alexander.shukaev.name> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1528718998 1439 195.159.176.226 (11 Jun 2018 12:09:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2018 12:09:58 +0000 (UTC) User-Agent: Roundcube Webmail/1.1.2 Cc: Emacs-devel , Emacs developers To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 11 14:09:54 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fSLdx-0000FQ-8U for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 14:09:53 +0200 Original-Received: from localhost ([::1]:48374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSLg2-0000aX-F1 for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2018 08:12:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSLft-0000aB-Fb for emacs-devel@gnu.org; Mon, 11 Jun 2018 08:11:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSLfs-0005K2-GN for emacs-devel@gnu.org; Mon, 11 Jun 2018 08:11:53 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:50487) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fSLfo-0005HI-4Q; Mon, 11 Jun 2018 08:11:48 -0400 Original-Received: from webmail.gandi.net (unknown [10.200.201.13]) (Authenticated sender: forum@alexander.shukaev.name) by relay8-d.mail.gandi.net (Postfix) with ESMTPA id 2D6331BF20A; Mon, 11 Jun 2018 12:11:53 +0000 (UTC) In-Reply-To: X-Sender: emacs@alexander.shukaev.name X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.201 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226196 Archived-At: On 2018-06-11 13:59, Noam Postavsky wrote: > On 11 June 2018 at 06:27, Alexander Shukaev > wrote: > >> Well, enough rant. I think I have a proposal how to fix the issue, >> even >> given the blocking nature of Emacs. How about introducing a variable >> `file-access-timeout' defaulting to `nil', which would reflect a >> configurable timeout for all access operations (such as >> `file-readable-p')? >> This would be achieved via `SIGALARM' in the C code, which would >> protect >> every such operation. For example, > > Does it work? According to some messages on the previous thread you > referenced [1], NFS hangs happen in the kernel so a signal would not > help. > > [1]: > https://lists.gnu.org/archive/html/help-gnu-emacs/2015-11/msg00266.html Go ahead and try: import os import signal import subprocess class Alarm(Exception): pass def alarm_handler(signum, frame): raise Alarm path = '/mnt/' signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(3) try: proc = subprocess.call('stat ' + path, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE) stdoutdata, stderrdata = proc.communicate() signal.alarm(0) except Alarm: print "Timed out after 3 seconds..."