GNOME Bugzilla – Bug 777007
gnome-terminal leaks pts when closing tabs
Last modified: 2017-01-08 12:41:05 UTC
Description copied from https://bugzilla.gnome.org/show_bug.cgi?id=772354#c19. Recent commit d4e25a5 causes GNOME Terminal to leak a pts when a tab is closed. After using it for several days, I have 4 tabs but with hundreds of pts in /dev/pts. Steps to Reproduce: 1. Start terminal with 3 tabs and type 'tty' command in each tab. My result is /dev/pts/25, /dev/pts/26, /dev/pts/27. 2. Close the first tab (/dev/pts/25) and we have 2 tabs left in this step. 3. Open a new tab. We have 3 tabs again in this step. Expected Results: The newly opened tab should reuse the recently closed pts (/dev/pts/25). Actual Results: The newly opened tab use /dev/pts/28, and /dev/pts/25 still exists. On FreeBSD, you can run 'procstat -f <pid>' and see 4 pts are opened by gnome-terminal-server. The same problem also happens on Linux, but I don't know which command can be used to show the name of opened pts. 'lsof -p <pid>' and 'ls -l /proc/<pid>/fd' only show /dev/ptmx. $ procstat -f 33650 PID COMM FD T V FLAGS REF OFFSET PRO NAME 33650 gnome-terminal-serv text v r r------- - - - /home/lantw44/gnome/devinstall/libexec/gnome-terminal-server 33650 gnome-terminal-serv cwd v d r------- - - - /home/lantw44 33650 gnome-terminal-serv root v d r------- - - - / ... 33650 gnome-terminal-serv 23 t - rw---n-- 1 0 - pts/25 33650 gnome-terminal-serv 24 t - rw---n-- 1 0 - pts/26 33650 gnome-terminal-serv 25 t - rw---n-- 1 0 - pts/27 33650 gnome-terminal-serv 26 t - rw---n-- 1 0 - pts/28
Fixed on master.