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

swaymsg waiting && sway 100% cpu usage #1152

Closed
sohorx opened this issue Apr 7, 2017 · 6 comments
Closed

swaymsg waiting && sway 100% cpu usage #1152

sohorx opened this issue Apr 7, 2017 · 6 comments

Comments

@sohorx
Copy link

sohorx commented Apr 7, 2017

Hi, first of all thank for your cool work.

I'm using archlinux and using sway 0.12.1-1 from community,
so here the issue:
while I was trying to put the focused window title inside conky using swaymsg -t get_tree with an interval of 0.5sec it appear that after 4 to 5 min swaymsg does not respond anymore while sway get a 100% cpu usage.

this being the half working script used by conky

swaymsg -t get_tree | sed '/focused": true/,$!d' | grep "title" | head -1 | cut -d '"' -f4

I don't know if using swaymsg this way is what I should do but since I can't use Xlib to get wayland window title and wayland does not allow me to see the focused window title, this is the only way I found.

@ddevault
Copy link
Contributor

ddevault commented Apr 7, 2017

Been running your command in a loop for a while, CPU usage seems nominal. Something else is probably the cause.

@ascent12
Copy link
Member

ascent12 commented Apr 7, 2017

I managed to reproduce the same issue after running it in a loop for about 10 minutes or so, also from the archlinux community version.

Using

#!/bin/bash

i=0

while true; do
	echo "$i"
	swaymsg -t get_tree > /dev/null
	((i++))
done

it freezes at 989, but does not cause any spike in CPU usage for me.
After trying to run it again:

Unable to accept IPC client connection: Too many open files

is spammed in sway's output.

I tried with the master branch as well, and the same thing happens.

@ddevault
Copy link
Contributor

ddevault commented Apr 7, 2017

Interesting, maybe the fds aren't closed properly.

@ddevault
Copy link
Contributor

ddevault commented Apr 7, 2017

Does #1153 fix the problem for you?

@ascent12
Copy link
Member

ascent12 commented Apr 7, 2017

That fixes it, but I think the real issue is that client->fd is being set to -1 before the call to ipc_client_disconnect, so the cleanup functions in there aren't being called properly.

@ddevault
Copy link
Contributor

ddevault commented Apr 7, 2017

Ah, good point.

@ddevault ddevault closed this as completed Apr 7, 2017
ddevault added a commit that referenced this issue Apr 7, 2017
Fix dangling file descriptors (fixes #1152)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants