(Hidden by Administrator)
Bug 508427 Comment 141 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
OK, some update (thanks Wayne Mery for pinging me): I am now on Thunderbird 52.2.1 as is in Ubuntu 16.04 and things look a bit better. Large CPU spikes once per minute are either one or much shorter now so that they are less visible. I suspect that has to do with the sessionrestore topic, which was discussed also here for Firefox: bug 1304389 Regarding fonts stat()ing, I see it happen every 30 seconds in strace (for example grep for "type1/gfonts"), but timings (strace -t -t -t) show that the 152 fonts that it stats are done in 12 ms total each time. So 12 ms every 30 seconds isn't a real problem. The layout.frame_rate setting certainly brings down the number of syscalls but using it isn't nice because low UI FPS when using a program are a pain. It seems we have established (especially comments 127 and 130) that the poll/recvmsg is how X applications talk to the X server. To give some more detail, this is an strace of a gnome-terminal with a flashing cursor that flashes every ~0.6 seconds (sudo strace -t -t -t -f -p $(pidof gnome-terminal-server)): [pid 12497] 1501520214.564856 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520214.566188 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout) [pid 12497] 1501520214.567313 poll([{fd=4, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}]) [pid 12497] 1501520214.567470 writev(4, [{"5 \4\0004D\300\3uB\300\3\f\0\23\0\213\4\6\0005D\300\0034D\300\3&\0\0\0"..., 304}, {NULL, 0}, {"", 0}], 3) = 304 [pid 12497] 1501520214.567675 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520214.567785 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=14, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=21, events=POLLIN}], 7, 598) = 0 (Timeout) [pid 12497] 1501520215.166758 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520215.167876 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout) [pid 12497] 1501520215.168985 poll([{fd=4, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}]) [pid 12497] 1501520215.169140 writev(4, [{"5 \4\0006D\300\3uB\300\3\f\0\23\0\213\4\6\0007D\300\0036D\300\3&\0\0\0"..., 332}, {NULL, 0}, {"", 0}], 3) = 332 [pid 12497] 1501520215.169324 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520215.169519 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=14, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=21, events=POLLIN}], 7, 598) = 0 (Timeout) [pid 12497] 1501520215.768489 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520215.769896 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}], 3, 0) = 0 (Timeout) [pid 12497] 1501520215.770731 poll([{fd=4, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=4, revents=POLLOUT}]) [pid 12497] 1501520215.770927 writev(4, [{"5 \4\0008D\300\3uB\300\3\f\0\23\0\213\4\6\0009D\300\0038D\300\3&\0\0\0"..., 304}, {NULL, 0}, {"", 0}], 3) = 304 [pid 12497] 1501520215.771073 recvmsg(4, 0x7ffebb2e33f0, 0) = -1 EAGAIN (Resource temporarily unavailable) [pid 12497] 1501520215.771322 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=6, events=POLLIN}, {fd=14, events=POLLIN}, {fd=17, events=POLLIN}, {fd=18, events=POLLIN}, {fd=21, events=POLLIN}], 7, 598) = 0 (Timeout) Notably, when the window is not focused and the user doesn't do anything, then *all* strace output stops, so gnome-terminal isn't doing any idle IO. Interestingly though, there is strace output for it when the user presses a key (for example Ctrl), even when the gnome-terminal window isn't focused, which suggests that gnome-terminal gets global key press notifications. Doing the same with xterm reveals that it doens't do that. What it does show though is this strange use of recvmsg on Window focus: 501520751.933500 recvmsg(3, 0x7ffd9d1acc00, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520751.933563 recvmsg(3, 0x7ffd9d1aca00, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520751.933618 recvmsg(3, 0x7ffd9d1aca00, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520751.933669 poll([{fd=3, events=POLLIN}], 1, 0) = 0 (Timeout) Here recvmgs is called 3 times in arow with the same result. Not sure why a program (or the X lib) would do that. But thunderbird displays similar behaviour: 1501520882.093979 recvmsg(4, 0x7fff1dcd9890, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520882.094150 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=26, events=POLLIN}, {fd=27, events=POLLIN}, {fd=66, events=POLLIN}], 5, 0) = 0 (Timeout) 1501520882.094312 recvmsg(4, 0x7fff1dcd9890, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520882.094504 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=26, events=POLLIN}, {fd=27, events=POLLIN}, {fd=66, events=POLLIN}], 5, 0) = 0 (Timeout) 1501520882.094788 recvmsg(4, 0x7fff1dcd9890, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520882.094940 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=26, events=POLLIN}, {fd=27, events=POLLIN}, {fd=66, events=POLLIN}], 5, 0) = 0 (Timeout) 1501520882.095176 recvmsg(4, 0x7fff1dcd9890, 0) = -1 EAGAIN (Resource temporarily unavailable) 1501520882.095343 poll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=26, events=POLLIN}, {fd=27, events=POLLIN}, {fd=66, events=POLLIN}], 5, -1 <unfinished ...> 3 calls to recvmsg (each with EAGAIN), 3 seemingly pointless calls to poll() with 0-timeout, and only the 4th poll() uses timeout -1 (for infinite wait until some event happens, which makes sense). All of that happens even when Thunderbird runs in "Work offline" mode, which I recommend everone to check out in order to separate network issues from plain Xorg drawing issues. Even in "Work offline" mode, there's quite a lot going on in strace, but there's a lot more when you're online. It seems to me that a good way forward with this bug would be to investigate where all the syscalls come from (especially the ones that look redundant), and to check if Thunderbird does any kind of unnecessary idle redrawing (gnome-terminal and xterm show that this can apparently completely be avoided).