2

In an AIX system (AIX p740 1 7) that is running for about several months, some pts aren't reused anymore.

This was noticed using the "who" command, with the following "awk" expression, running it daily for weeks:

who | awk '{ printf "%s %s\n", $2, $1 }' | awk -F'/' '{ printf "%s\n", $2 }' | sort -n | awk 'BEGIN{port=$1} {if (port+0 != $1) {printf "--- FREE PTS: %s - %s\n", port, $1-1}; printf "pts/%s (%s)\n", $1, $2; port=$1+1 }'  

A typical output, always shows the pts/14 as free, and all others ports, like 0, 1, 2, and so on, became free at night, and are allocated again in the next day, except the port 14 (I cannot examine more ports that can have the same behavior of pts/14, because there are about 600 ports being using daily, and the analysis stopped at the port 14).

pts/0 (foo)
pts/1 (foo)
pts/2 (foo)
pts/3 (foo)
pts/4 (user12)
pts/5 (bar)
pts/6 (user12)
pts/7 (foo)
pts/8 (user13)
pts/9 (foo)
pts/10 (foo)
pts/11 (foo)
pts/12 (bar)
pts/13 (foo)
--- FREE PTS: 14 - 14
pts/15 (foo)
pts/16 (foo)
pts/17 (user13)
pts/18 (user13)

There are ways to get the reason for this? And "release" this port ?

2
  • What is the concern?
    – mdpc
    Commented May 16, 2016 at 17:48
  • Why just this port isn't reused ? I don't know which more ports are behaving in the same way and could accumulate more ports, "blocking" them.
    – Luciano
    Commented May 16, 2016 at 17:56

1 Answer 1

2

who only shows logins. For example, tmux / screen opens a pty but I think it doesn't count as a login. I think you can find the process (pid) with fuser /dev/pts/14.

(I would use lsof on Linux, but fuser should be available on any posix system).

2
  • Interesting. I'll investigate it more deeply.
    – Luciano
    Commented May 16, 2016 at 21:41
  • Right ! That works ! I picked up the process. It was a process started in background. A new one question, but to separate the issues a created a new one asking the inverse, how to find the opened file(s) (pty(s)) for a given process: unix.stackexchange.com/q/283651/114939
    – Luciano
    Commented May 17, 2016 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .