Xpra: Ticket #691: win32 shadow server consumes 100% cpu even when inactive

shadow servers are inefficient as they use screenscraping, but when the window is not shown, we stop refreshing the pixels - yet on win32, the cpu remains at 100%

Wed, 24 Sep 2014 09:45:13 GMT - Antoine Martin: status changed; resolution set

To make it easier to debug such things, I added r7787 (full stacks for all threads in xpra info), r7785 network debug logging in error path.

And eventually I found that on windows with glib and sockets, we just get lots of spurious EWOULDBLOCK, see Watching sockets with Glib on Windows puts them in non-blocking mode, because glib puts the socket in non-blocking mode.. and we just can't force it into blocking mode (I've tried).

So, r7790 does an ugly fix and introduces an up to 5ms sleep in the socket loop for win32 sockets (it starts at 0ms and goes up to 5ms) which isn't as good as blocking sockets or a working non-blocking polling implementation... but keeps the changes minimal. The win32 will wakeup up to 200 times per second on those sockets, but this barely registers in terms of CPU usage now.

I have also tested the win32 client to make ensure that this does not make any difference there. The win32 shadow server is quite broken in 0.14.x already, not sure this is worth backporting, closing.

Fri, 26 Sep 2014 03:46:31 GMT - Antoine Martin:

Backport in r7811.

Mon, 08 Aug 2016 05:44:27 GMT - Antoine Martin:

r13270 moves the win32 socket workaround code to win32 servers only. (no need to penalise win32 clients)

Sat, 23 Jan 2021 05:03:07 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/691