[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`Compile' hang on remote files, not sure if it is a concurrent race issu
From: |
Fan Yang |
Subject: |
`Compile' hang on remote files, not sure if it is a concurrent race issue |
Date: |
Sun, 24 May 2020 00:23:01 +0800 |
Hi all,
I’m look for any help for a hang issue when compiling remote files using
“compile.el”.
Here is how I re-produce it:
- emacs -Q
- C-x C-f "/scp:vm01:pbd/virtio_balloon.c” (I’ve injected some typos into
this file to make the compilation error).
- M-x compile
- The “*compilation*” buffer shows with the following content:
-*- mode: compilation; default-directory: "/scp:vm01:/home/fan/pbd/" -*-
Compilation started at Sat May 23 23:18:30
make
make -C /lib/modules/5.3.7-301.fc31.x86_64/build M=$PWD
make[1]: Entering directory '/usr/src/kernels/5.3.7-301.fc31.x86_64'
CC [M] /home/fan/pbd/virtio_balloon.o
- Then Emacs hangs with no CPU activity.
- I start a terminal and run "pkill -SIGUSR2 Emacs”
- The Emacs becomes alive, with the “*compilation*” buffer displaying the
full content of error, and a “*Backtrace*”:
Debugger entered--entering a function:
* tramp-signal-hook-function(quit nil)
accept-process-output(#<process *tramp/scp vm01*> nil nil t)
tramp-accept-process-output(#<process *tramp/scp vm01*>)
tramp-wait-for-regexp(#<process *tramp/scp vm01*> nil
"\\(^\\|\0\\)[^#$\n]*///4e71ffd477719118f2d80d0a44acf5e3#\\$\\(\33[[0-9]+n\\)?\15?$")
tramp-wait-for-output(#<process *tramp/scp vm01*>)
tramp-send-command((tramp-file-name "scp" nil nil "vm01" nil
"/usr/src/kernels/5.3.7-301.fc31.x86_64" nil) "\\readlink
--canonicalize-missing /usr/src/kernels/5.3.7-301.fc31.x86_64 2>/dev/null; echo
tramp_exit_status $?")
tramp-send-command-and-check((tramp-file-name "scp" nil nil "vm01" nil
"/usr/src/kernels/5.3.7-301.fc31.x86_64" nil) "\\readlink
--canonicalize-missing /usr/src/kernels/5.3.7-301.fc31.x86_64")
tramp-sh-handle-file-truename("/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
apply(tramp-sh-handle-file-truename
"/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
tramp-sh-file-name-handler(file-truename
"/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
apply(tramp-sh-file-name-handler file-truename
"/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
tramp-file-name-handler(file-truename
"/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
file-truename("/scp:vm01:/usr/src/kernels/5.3.7-301.fc31.x86_64")
compilation-get-file-structure(("./include/linux/export.h" .
"/usr/src/kernels/5.3.7-301.fc31.x86_64") nil)
compilation-internal-error-properties(("./include/linux/export.h" .
"/usr/src/kernels/5.3.7-301.fc31.x86_64") 45 nil nil nil 0 nil)
compilation-error-properties(1 2 nil 3 nil (4 . 5) nil)
compilation-parse-errors(292 1239)
compilation--parse-region(292 #<marker at 1316 in *compilation*>)
compilation--ensure-parse(1316)
compilation-filter(#<process compilation> "In file included from
./include/linux/export.h:45,\n from
./include/linux/linkage.h:7,\n from
./include/linux/kernel.h:8,\n from ./include/linux/list.h:9,\n
from ./include/linux/module.h:9,\n from
/home/fan/pbd/virtio_balloon.c:7:\n/home/fan/pbd/virtio_balloon.c: In function
'file_vpb':\n./include/linux/kernel.h:990:51: error: dereferencing pointer to
incomplete type 'struct virtio_balloon'\n 990 |
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \\\n |
^~\n./include/linux/compiler.h:330:9: note: in definition of macro
'__compiletime_assert'\n 330 | if (!(condition)) \\\n |
^~~~~~~~~\n./include/linux/compiler.h:350:2: note: in expansion of macro
'_compiletime_assert'\n 350 | _compiletime_assert(condition, msg,
__compiletime_assert_, __LINE__)\n |
^~~~~~~~~~~~~~~~~~~\n./include/linux/build_bug.h:39:37: note: in expansion of
macro 'compiletime_a")
read-event(nil t 2)
sit-for(2)
execute-extended-command(nil "compile" "compile")
funcall-interactively(execute-extended-command nil "compile" "compile")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
This happens only to two of my remote projects, and only when I inject such
typos that producing many lines of compilation errors and warnings. Once I run
into this issue (for a specific remote project, and specific typos), I can
re-produce again and again. I tried Emacs on mac (--with-ns) and Emacs on
Ubuntu 18.04, they both have this issue.
I once wondered whether it is due to a race to the same TRAMP connection since
the “compilation--parse-region” seems can run concurrently with the “compile”
process. I boldly hacked “compilation-filter” to make it deferred until the
compilation completes:
(defun compilation-filter (proc string)
"Process filter for compilation buffers.
Just inserts the text,
handles carriage motion (see `comint-inhibit-carriage-motion'),
and runs `compilation-filter-hook'."
(when (buffer-live-p (process-buffer proc))
+ (while (memq proc compilation-in-progress) (sleep-for 1))
(with-current-buffer (process-buffer proc)
(let ((inhibit-read-only t)
Then the hang issue disappears. Though I’m totally not sure if the issue is
really due to the race. And I know this is only a temporary workaround.
Do you know can TRAMP handle concurrent access to the same connection
correctly, especially in this case? And do you have any idea/advise how to fix
this hang issue?
Thanks
Fan
- `Compile' hang on remote files, not sure if it is a concurrent race issue,
Fan Yang <=