Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emacs hangs on scratch buffer for 2 seconds when opening unless key is pressed #1775

Closed
vemacs opened this issue Mar 13, 2017 · 12 comments
Closed

Comments

@vemacs
Copy link

vemacs commented Mar 13, 2017

Description: emacs-nox takes an order of magnitude slower to load than on a "real" Ubuntu 14.04 machine with worse specifications, and other text editors

Expected results: emacs should open almost instantaneously, allowing you to edit files

Actual results: emacs hangs on a scratch buffer for about 2 seconds before opening any file. You can "skip" this delay by pressing a random key, but that inserts weird characters at the top of the file (#1505) and isn't something you want to do every time you want to edit a file.

Timings on Bash on Ubuntu on Windows:

[01:22:48] ylin:~ $ time emacs --debug-init --eval '(kill-emacs)'

real    0m2.253s
user    0m0.016s
sys     0m0.203s
[01:23:26] ylin:~ $ time emacs --debug-init -eval '(kill-emacs)' -Q

real    0m2.247s
user    0m0.047s
sys     0m0.141s

Timings with real Ubuntu 14.04.5 installation on a slower computer:

[06:30:04] vemacs@vlt-stor:~ $ time emacs --debug-init --eval '(kill-emacs)'

real    0m0.097s
user    0m0.028s
sys     0m0.024s
[06:30:56] vemacs@vlt-stor:~ $ time emacs --debug-init --eval '(kill-emacs)' -Q

real    0m0.088s
user    0m0.024s
sys     0m0.012s

Windows build number: 15055, this has happened on every Bash on Ubuntu on Windows since 14393.

Steps:

sudo apt-get install emacs24-nox
emacs myfile.txt

Timing commands are provided in the Actual Results section.

@vemacs vemacs changed the title emacs very slow to load emacs hangs on scratch buffer for 2 seconds when opening Mar 13, 2017
@vemacs vemacs changed the title emacs hangs on scratch buffer for 2 seconds when opening emacs hangs on scratch buffer for 2 seconds when opening unless key is pressed Mar 13, 2017
@stehufntdev
Copy link
Collaborator

Thanks for reporting the issue. Can you please share out an strace with timestamps of the emacs launch?

@vemacs
Copy link
Author

vemacs commented Mar 15, 2017

I am running strace -r -o emacs_strace.txt emacs --debug-init --eval '(kill-emacs)'.

strace on Bash on Ubuntu on Windows with relative timestamps: http://paste.ubuntu.com/24184468/

The hang appears to be at:

    1.995777 ioctl(3, FIONREAD, [0])   = 0

Here is the strace on a real Ubuntu 14.04 machine that exhibits no hang: http://paste.ubuntu.com/24184497/

@stehufntdev
Copy link
Collaborator

Thanks for providing the strace! Looking through the code the only thing I can think of here is waiting with a lock held, but I'll need to get a local repro and report back.

@vemacs
Copy link
Author

vemacs commented Mar 22, 2017

I upgraded my Bash on Ubuntu on Windows installation to 16.04 and this is still an issue, by the way.

@stehufntdev
Copy link
Collaborator

Thanks for the update. Marking this as a bug for tracking.

@stehufntdev stehufntdev added bug and removed need-repro labels Apr 7, 2017
@vemacs
Copy link
Author

vemacs commented Apr 15, 2017

Sorry for bothering you guys again, I just took a new strace on 16.04 and the hanging call is slightly different. Here's the strace: http://paste.ubuntu.com/24389133/

Here's the hanging call:

1.995286 poll([{fd=6, events=POLLIN}], 1, 0) = 0 (Timeout)

Here's lsof output while the hang is occurring: http://paste.ubuntu.com/24389164/

@stehufntdev
Copy link
Collaborator

Not a bother at all, and thanks for the update. Based on the above, we're probably missing an epoll update.

@xarthurx
Copy link

I can confirm with this issue. using Emacs25.

Another observation is, it seems the problem is related to FS IO.
emacs open/read files for the first time will be painfully slow.
But after that, reopen/re-read will be fast as long as you don't kill emacs or close bash.exe.

@zachmu
Copy link

zachmu commented Aug 7, 2019

Issue is still alive and well. Has anyone discovered a workaround?

@HenryGessau
Copy link

GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu)
Windows 10 Pro, Version 10.0.19041 Build 19041
WSL2
Still seeing the problem.

@therealkenc
Copy link
Collaborator

@HenryGessau what is the output you get from the OP repro on 19041:

image

@HenryGessau
Copy link

@therealkenc I am no longer encountering this issue. Sorry, I don't know when it stopped happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants