1

I have flymake enabled in my Emacs configuration. Locally it works fine, but when I try to open a remote html file with tramp, Emacs hangs and I have to kill it.

I tried to check with gdb, and the top of the stack is as follows:

#0  0x00007fcee786c83c in __pselect (nfds=<optimized out>, readfds=<optimized out>, writefds=<optimized out>, exceptfds=<optimized out>, timeout=<optimized out>, sigmask=<optimized out>)
at ../sysdeps/unix/sysv/linux/pselect.c:79
#1  0x00000000004d02f7 in xg_select (fds_lim=13, rfds=0x7fff4d830210, wfds=0x0, efds=0x0, timeout=0x7fff4d830460, sigmask=0x0) at xgselect.c:48
#2  0x00000000005947f3 in wait_reading_process_output (time_limit=<optimized out>, nsecs=0, read_kbd=0, do_display=false, wait_for_cell=12096626, wait_proc=<optimized out>, just_wait_proc=1) at process.c:4633
#3  0x0000000000597429 in Faccept_process_output (process=56383997, seconds=<optimized out>, millisec=<optimized out>, just_this_one=<optimized out>) at process.c:4026

So it seems that for some reason the xmlstarlet process on the remote machine, but I have no idea why.

The command that flymake uses should be xmlstarlet val filename.html, which executes with no problems from the command line. Configuring flymake to use other programs such as tidy or xmllint doesn't change anything.

Any suggestion on what I could do to be able to debug the issue ?

Edit

In fact after a while (at least 1 minute) the command completes. After the startup there are no longer waits for the same buffer, and flymake works as expected.

Details on the system

I'm connecting from an Ubuntu 12.04 machine. I tried to connect to a FreeBSD 9.3 machine, but I have the same problem on a DragonflyBSD machine. The remote shell is zsh on both systems, but changing it to bash doesn't help.

Stacktrace

This is the full lisp stacktrace I get.

https://gist.github.com/mrighele/8371399

the flymake-html-init is the one presented in the emacs wiki

Interestingly, when I send the signal, the content of the file buffer is overwritten with the following, not sure if it is of any interest.

tramp_perl_file_truename () {
function> \perl5 -e '
function quote> use File::Spec;
function quote> use Cwd "realpath";
function quote> sub recursive {
function quote>     my ($volume, @dirs) = @_;
function quote>     my $real = realpath(File::Spec->catpath(
function quote>                    $volume, File::Spec->catdir(@dirs), ""));
function quote>     if ($real) {
function quote>         my ($vol, $dir) = File::Spec->splitpath($real, 1);
function quote>         return ($vol, File::Spec->splitdir($dir));
function quote>     }
function quote>     else {
function quote>         my $last = pop(@dirs);
function quote>         ($volume, @dirs) = recursive($volume, @dirs);
function quote>         push(@dirs, $last);
function quote>         return ($volume, @dirs);
function quote>     }
function quote> }
function quote> $result = realpath($ARGV[0]);
function quote> if (!$result) {
function quote>     my ($vol, $dir) = File::Spec->splitpath($ARGV[0], 1);
function quote>     ($vol, @dirs) = recursive($vol, File::Spec->splitdir($dir)<sive($vol, File::Spec->splitdir($dir))                                       <sive($vol, File::Spec->splitdir($dir));
function quote>     $result = File::Spec->catpath($vol, File::Spec->catdir(@di<>catpath($vol, File::Spec->catdir(@dir                                       <>catpath($vol, File::Spec->catdir(@dirs), "");
function quote> }
function quote> if ($ARGV[0] =~ /\/$/) {
function quote>     $result = $result . "/";
function quote> }
function quote> print "\"$result\"\n";
function quote> ' "$1" 2>/dev/null
function> } 2>/dev/null; echo tramp_exit_status $?
tramp_exit_status 0
Marco Righele
  • 2,702
  • 3
  • 23
  • 23
  • I've no idea whether it will be useful, but you might like to check http://stackoverflow.com/questions/3145746/running-pyflakes-remotely-with-flymake-and-tramp-in-emacs to see if there is any helpful cross-over. There's also https://github.com/flycheck/flycheck which was written as a replacement for flymake. – phils Jan 08 '14 at 02:30

1 Answers1

1

Try the following:

(setq debug-on-event 'sigusr2)

and then when Emacs is frozen, do kill -USR2 <emacspid> from a shell. That should hopefully give you a lisp-level backtrace which will help track down the problem.

Stefan
  • 27,908
  • 4
  • 53
  • 82
  • Thanks, it didn't help in this particular case (from the backtrace I can't figure from which program emacs is waiting output from) , but it may prove very useful in future. – Marco Righele Dec 08 '13 at 02:23
  • Can you post the backtrace? – Stefan Dec 10 '13 at 01:09
  • Sorry for the long delay. If you're still interested, I've posted the relevant stacktrace. – Marco Righele Jan 08 '14 at 01:37
  • Apparently the wait is that Tramp is waiting for the "end of output" marker of the flymake process (which was run remotely via Tramp). Not sure why it's not receiving (or not seeing) the end-of-output marker. The backtrace also doesn't explain why C-g doesn't work. Did you post the complete backtrace, or is there some "higher up" parts which you snipped? – Stefan Jan 08 '14 at 13:27
  • This is the topmost part of the stack. It should contain everything from the moment the function flymake-html-init is called, but I realize now some of the bottom part is missing (some bytecode values interact badly with copy-and-paste). I'll update the post when I'm back at that machine. – Marco Righele Jan 09 '14 at 09:19