-
Notifications
You must be signed in to change notification settings - Fork 705
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
CPU usage at 100% #1594
Comments
I debugged the program a bit and nothing wrong occurs to me, except the fact that the
|
It looks like my terminal has a bug and doesn't shut processes properly. I attached strace to a running process and closed it in two different terminals.
On the other hand, Tilix does this:
(and it goes on and on). |
Putting a breakpoint on |
diff --git a/src/main.cc b/src/main.cc
index c69c72a3..1b3dfabe 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -676,6 +676,9 @@ int run_server(StringView session, StringView server_init,
throw convert_to_client_mode{ std::move(session), std::move(buffer_name), std::move(selections) };
}
}
+
+ if (not isatty(1))
+ terminate = true;
}
}
catch (const kill_session&) {} |
After a reboot I cannot reproduce the high CPU usage anymore, |
This time after a logout and relogin, a kak process was still open and doing this at a blazing speed:
|
Something is flooding the process' |
not flooding it with empty strings, read returning zero means we hit the end of file, which for stdin would mean the terminal is gone, but we should have received a SIGHUP if that was the case. |
Wouldn't a broken pipe occur if the terminal was gone, because the file descriptor wouldn't be reading from anything anymore? I'm surprised no error events are produced by |
It is in fact because |
I just had the same thing happen with the JSON UI, where Kakoune doesn't have a controlling terminal. The parent process exited, so Kakoune's stdin was closed, so it sat there buzzing at 100% CPU until I killed it. |
I remember this happening sometimes using my QML ui. I'm reopening this for the moment, but I have no time to look into it. |
I seem to be having this issue at times aswell. |
Just got kakoune some nice 20 minutes ago, apart for the fact that CPU usage's been stuck at 100% the whole time, I'm very impressed. Typing this, I realized I miss kakoune already! |
% kak -version
Kakoune v2019.01.20 It was the first time I've ever opened kak, apart for that nothing special. |
What machine is that running on ? Would it be possible to run a profiler on it to see whats taking time ? |
Well, unfortunately now it is only running at ~0,0% CPU usage :D My machine is a MacBookAir4,1 1.0 I've no idea how to profile kakoune, but with some instructions to refer to, I'll happily do so if this happens again. |
On linux, install |
Excellent! I will do so if the situation arises again. |
I've been having kakoune instances running at 100% for a while.
Common factor in all these is that they were processes that I had closed since long (probably by just killing the terminal, but I'm not that sure).
Today I profiled a running instance with
perf
and this is what I've got (~50MB):https://mega.nz/#!mQskAQrJ!YgvpHaGdeZgBrNcKC5oI9NCom3jjxfltrcTdMl2nXD4
[Use
perf report
to see the call graph]I could still attach to the session with kak -c and it looks like everything is normal, that old buffer was still open (asking for reload due to changes) and I could navigate it and so on.
I'm leaving the process open for a few hours in case someone wants to chime in and tell me what to profile exactly.
Some debug info:
The text was updated successfully, but these errors were encountered: