0

I'm running emacs24-nox on Ubuntu trusty on Windows Linux Subsystem, and I'm trying to figure out why the startup time is slow. I've inspected the startup with strace and found two calls to poll that are apparently timing out after 2 seconds each. Any ideas what's going on here? Details below.

Step 1: In which I demonstrate my environment

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

$ uname -a
Linux MACHINE 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Step 2 In which I demonstrate that I have nothing up my sleeves and perform the trick

$ rm -rf ~/.emacs ~/.emacs.d
$ strace -r emacs -Q --eval '(kill-emacs)' 2>emacs.trace

Step 3 In which I find the top 10 slowest steps and puzzle at the slow polls

$ sort -n emacs.trace | tail
     0.002705 write(5, "\33[52d\33[?25lFor information about"..., 101) = 101
     0.003640 open("/etc/emacs24/subdirs.el", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
     0.004009 rt_sigprocmask(SIG_BLOCK, [WINCH IO], NULL, 8) = 0
     0.004640 faccessat(AT_FDCWD, "/usr/local/sbin/ssh", X_OK) = -1 ENOENT (No such file or directory)
     0.005136 brk(NULL)                 = 0x2d75000
     0.005468 clock_gettime(CLOCK_REALTIME, {1506025490, 364029200}) = 0
     0.008012 write(5, "\33[?1l\33>\33[?12l\33[?25h\33[?1049l\33[39;"..., 36) = 36
     0.019146 fstat(6, {st_mode=S_IFREG|0644, st_size=1196, ...}) = 0
     1.990251 poll([{fd=6, events=POLLIN}], 1, 0) = 0 (Timeout)
     1.995195 poll([{fd=6, events=POLLIN}], 1, 0) = 0 (Timeout)
  • After more debugging and poking around the trace file, I suspect the issue is with WSL's implementation of eventfd, so this is probably not an emacs issue. I'll try to get the beta version of WSL to see if the fix for github.com/Microsoft/BashOnWindows/issues/2088 also fixes the startup problems – Jimmy Sep 21 '17 at 20:51
0

This was a bug in Windows Subsystem for Linux and is fixed by the upcoming (as of Sep 2017) Fall Creators update. until that ships, you can subscribe to Insider Updates Preview builds (Active development / Slow channel) to get a fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.