IBM AIX TCP/IP rmsock command - United States

Wednesday, July 19, 2017

11:48 AM

  • IBM Support

    Search support or find a product: Search

    AIX TCP/IP rmsock command

    Technote (FAQ)

    Question

    When to use the rmsock command

    Answer

    TCP/IP Utilities to use When the socket does not have a file descriptor

    The system administrator is running his usual commands and tools and everything is right in the world. Then it happens, an error log somewhere indicating an TCP application had to stop and restart but it can't restart. Further analysis of error codes indicates that it cannot restart because the reserve ports are in use. It looks like the other end of the connection is down and the sockets used by this application has not reached it timeout limits. Until then, the system will not cleanup these sockets and our hopes of a reboot is not an option.

    By using netstat with the -Aan options, you can obtain the process control block (PCB) address of a socket structure.

    Example:

    You are looking at the socket in FIN_WAIT_1 state on your system. Looks like it is a telnet connection using destination port 23 and an ephemeral port 58420. Note in this scenario, the application should be able to restart if it is using a new ephemeral port, unless all ephemeral ports are used, which is highly unlikely and in that case there are bigger issues at hand.

    # netstat -aAn|grep FIN

    f1000e000258d3b8 tcp 0 0 192.168.1.114.58420 192.168.1.115.23 FIN_WAIT_1

    Now to remove the socket...

    # rmsock f1000e000258d3b8 tcpcb

    socket 0x258d008 is removed.

    Which socket states from netstat are candidates for the rmsock command?

    FIN_WAIT_1,FIN_WAIT_2, TIME_WAIT, CLOSING are all states where the application performed an active close of the socket.

    How do we know a socket is no longer associated with a process?

    You can use lsof to check. It is highly recommend that you use netstat in conjunction with lsof to validate the situation prior to doing anything drastic.

    Which socket states are not candidates for the rmsock command?

    CLOSE_WAIT, CLOSED

    Why are CLOSE_WAIT and CLOSED not suitable for rmsock?

    The short answer is both have file descriptors associated with them. A CLOSE_WAIT means the application has done an passive close and is awaiting a response. A CLOSED state means the socket was created, but has not been used. The rmsock command is useless in this instance, but if you are absolutely and positively sure this socket needs to be terminated, then use the kill command to take out the application.

    Example:

    # netstat -aAn|grep CLOS*

    f1000e0000aa4bb8 tcp 0 0 *.* *.* CLOSED

    f1000e0000aa1bb8 tcp4 0 0 *.* *.* CLOSED

    f1000e0000acc3b8 tcp6 0 0 ::1.32777 ::1.32778 CLOSE_WAIT

    Notice it is still associated with a file descriptor and process!

    # kdb

    ...

    (0)> sockinfo f1000e0000acc3b8 tcpcb

    ...

    proc/fd: 88/134

    proc/fd: fd: 134

    SLOT NAME STATE PID PPID ADSPACE CL #THS

    pvproc+016000 88*java ACTIVE 05800D0 05C003E 0000000858496400 0 0050

    (0)> hcal 05800D0

    Value hexa: 005800D0 Value decimal: 5767376

    # ps auxw|grep 5767376

    root 5767376 0.0 6.0 78936 78952 - A Apr 25 8:06 /var/opt/tivoli/ep/_jvm/jre/bin/java -Xmx384m -Xminf0.01 -Xmaxf0.4

    Rate this page

    Click to rate document as Poor. The average rating is 4.5 star(s) based on 7 user(s). The document reputation is Very good.Click to rate document as Fair. The average rating is 4.5 star(s) based on 7 user(s). The document reputation is Very good.Click to rate document as Average. The average rating is 4.5 star(s) based on 7 user(s). The document reputation is Very good.Click to rate document as Good. The average rating is 4.5 star(s) based on 7 user(s). The document reputation is Very good.Click to rate document as Very good. The average rating is 4.5 star(s) based on 7 user(s). The document reputation is Very good.

    Average rating (7 users)

    Document information

    More support for: AIX family

    Software version: Version Independent

    Operating system(s): AIX

    Reference #: T1019570

    Modified date: 24 June 2015

    IBM Technical Support mobile app is now available!

    Get it on Google Play

    Site availability

    Site assistance

    Translate this page:

    Back to top

    Contact and feedback

    Close

    Contact and feedback

    Need support?

    • 1-800-IBM-7378 (USA)

    United States - English

    Close

    IBM Technical Support Feedback

    *

    Click to begin (comments optional)Characters remaining: 1000

    Providing your name and email will allow IBM to follow-up with you, if needed.

    Name:

    Email:

    Country:

    For technical support about IBM products, use IBM Support Portal.

    SubmitAbout feedback at IBM

    IBM Technical Support Feedback

    Thank you for your feedback!

    IBM reviews all feedback. Not all comments will receive a response.

    All responses will be in English.

    About ongoing feedback at IBM

    IBM collects opt-in feedback from IBM web users on a broad and continual basis throughout it's web sites. All feedback submitted are reviewed only by IBM employees or IBM affiliates and no feedback is shared outside of IBM for any reason. See IBM's privacy policy and terms of use for further detail.

    Back to Feedback

    Close

    IBM Technical Support Feedback

    Thank you for your rating. Please tell us how to improve the technical support document.

    Click to begin (comments optional)Characters remaining: 1000

    Providing your name and email will allow IBM to follow-up with you, if needed.

    Name:

    Email:

    Country:

    For technical support about IBM products, use IBM Support Portal.

    SubmitAbout feedback at IBM

    IBM Technical Support Feedback

    Thank you for your feedback!

    IBM reviews all feedback. Not all comments will receive a response.

    All responses will be in English.

    About ongoing feedback at IBM

    IBM collects opt-in feedback from IBM web users on a broad and continual basis throughout it's web sites. All feedback submitted are reviewed only by IBM employees or IBM affiliates and no feedback is shared outside of IBM for any reason. See IBM's privacy policy and terms of use for further detail.

    IBM may use a third party to collect or process feedback. Any such party is also bound by the IBM policy. Currently we use opinionlab for feedback processing.

    OpinionLab

    Back to Feedback

    Inserted from <http://www-01.ibm.com/support/docview.wss?uid=isg3T1019570>

Created with Microsoft OneNote 2016.