GNOME Bugzilla – Bug 562385
gnome-pty-helper goes to 100% cpu usage
Last modified: 2008-11-27 23:57:31 UTC
Please describe the problem: on openbsd/amd64, and perhaps other 64-bit platforms too, running "gnome-terminal" will make "gnome-pty-helper" approach the 100% cpu usage. this happens within a matter of seconds. this is currently unconfirmed on openbsd/sparc64 or other 64-bit ports, but it doesn't manifest itself on openbsd/i386. it has been an issue since at least two years now. there are some patches applied to the openbsd port of vte, which you can find here: http://www.openbsd.org/cgi-bin/cvsweb/ports/devel/vte/ Steps to reproduce: 1. start gnome-terminal on openbsd/amd64 (cpu-usage stays very low) 2. now start another terminal, notice that this process seems to go to the background when started from a shell (the prompt comes back, whilst this doesn't happen with the first terinal). 3. watch cpu usage approach 100% directly after the second terminal was started. Actual results: PID USERNAME PRI NICE SIZE RES STATE WAIT TIME CPU COMMAND 20892 jasper 64 0 300K 1412K onproc/1 - 1:02 94.29% gnome-pty-helper Expected results: the gnome-pty-helper process doesn't go beserk :) Does this happen every time? yes. Other information: please note that this doesn't happen when there's only one gnome-terminal running. right after the second terminal is started the problem occurs. kdump(1) reveals it is continuously retrying to read(2) from stdin without need. read(2) returns EAGAIN: > [EAGAIN] The file was marked for non-blocking I/O, and no data were > ready to be read. the bug in gnome-pty-helper is triggered by some input from gnome-terminal (g-p-h communicates via STDIN/STDOUT with g-t) when g-p-h is spawned by g-t. i can upload the kdump(1) file if needed.
(In reply to comment #0) > 2. now start another terminal, notice that this process seems to go to the > background when started from a shell (the prompt comes back, whilst this > doesn't happen with the first terinal). That's normal. gnome-terminal uses a server process, the 2nd call just forwards the arguments to the factory and exits. > please note that this doesn't happen when there's only one gnome-terminal > running. right after the second terminal is started the problem occurs. Does it also happen if you just open a new tab or window in the first gnome-terminal process?
yes, it also happens when i open a tab in the first gnome-terminal process.
(In reply to comment #2) > yes, it also happens when i open a tab in the first gnome-terminal process. same for opening a new window in the first gnome-terminal process btw.
Created attachment 123508 [details] [review] possible fix Just for reference , the code in question was introduced in bug 126554. Do the CMSG_SPACE and CMSG_LEN macros exist on your platform? If so, this should fix the problem (and also be more correct).
Created attachment 123510 [details] [review] updated patch Seems these defines may not exist on some platforms; so define them if they're not there yet.
thanks for this diff! it fixes the reported issue. so this can be closed.
Great, thanks for the testing. Behdad, Chris: does the patch look ok to you too?
I'm not following the details, but looks good, yes.
Committed to svn trunk: * gnome-pty-helper/gnome-pty-helper.c: (pass_fd), (pty_free), (main): Make sure data structures are correctly aligned and of the right size.