emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Hangs on Filesystem Operations on Stale NFS


From: Alexander Shukaev
Subject: Re: Emacs Hangs on Filesystem Operations on Stale NFS
Date: Mon, 11 Jun 2018 14:11:45 +0200
User-agent: Roundcube Webmail/1.1.2

On 2018-06-11 13:59, Noam Postavsky wrote:
On 11 June 2018 at 06:27, Alexander Shukaev
<address@hidden> 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/<nfs>'

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..."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]