V14 Listener job ends on startup with CPIC error: 0000000020 in bind

Date:24 March 2016
Product/Release:LANSA on IBM i - V14 and above
Abstract:Changed behaviour in the listener startup logic will prevent the listener from starting if the port is in use.
Submitted By:LANSA Technical Support

Description:

V14 has introduced a change to the LANSA Listener startup logic that checks if the listener port is already in use before allowing the listener to start. This is an enhancement designed to secure the integrity of the LANSA Listener. For example, to ensure that malicious programs do not open the port used by LANSA and intercept all data traffic. If the port is in use, then the listener will end immediately on startup.

This change has introduced an unexpected impact on the IBM i where it has been reported that in some cases the Listener port is not immediately released on the ending of the Listener job resulting in the Listener not being able to be restarted for up to 20 minutes.  The following are typical messages in the joblog:

LCO0107    Information             00   02/29/16  11:51:19.070626  DCXS86XX     G14COMLIB   *STMT    *EXT                    *N
                                     From module . . . . . . . . :   DCXP8602
                                     From procedure  . . . . . . :   DCXP8602AB
                                     Statement . . . . . . . . . :   3
                                     Message . . . . :   Listening for connection requests on port 04580.
                                     Listener job initialized. Listener is now ready to receive connection requests
                                       on port 04580.
LCO0301    Information             40   02/29/16  11:51:19.098309  LCOMGR40     G14COMLIB   *STMT    LCOMGR40    G14COMLIB   *STMT
                                     From module . . . . . . . . :   LCOCMISC
                                     From procedure  . . . . . . :   MISC_LogEvent__FUsUiPPCcT2
                                     Statement . . . . . . . . . :   9
                                     To module . . . . . . . . . :   LCOCMISC
                                     To procedure  . . . . . . . :   MISC_Error
                                     Statement . . . . . . . . . :   27
                                     Message . . . . :   Error in program LCOMGR40 LCOSLAPI :2912
                                       :CreateListenSocket at statement .
LCO0302    Information             40   02/29/16  11:51:19.098357  LCOMGR40     G14COMLIB   *STMT    LCOMGR40    G14COMLIB   *STMT
                                     From module . . . . . . . . :   LCOCMISC
                                     From procedure  . . . . . . :   MISC_LogEvent__FUsUiPPCcT2
                                     Statement . . . . . . . . . :   9
                                     To module . . . . . . . . . :   LCOCMISC
5770SS1 V7R1M0 100423                           Job Log                             DEMO     02/29/16 11:51:19          Page    2
  Job name . . . . . . . . . . :   LISTENER        User  . . . . . . :   G14PGMLIB    Number . . . . . . . . . . . :   119429
  Job description  . . . . . . :   G14LISTJD       Library . . . . . :   G14PGMLIB
MSGID      TYPE                    SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY     INST
                                     To procedure  . . . . . . . :   MISC_Error
                                     Statement . . . . . . . . . :   27
                                     Message . . . . :   Native error: 0000003420  CPIC error: 0000000020 in bind.
LCO0109    Information             30   02/29/16  11:51:19.098481  DCXS86XX     G14COMLIB   *STMT    *EXT                    *N
                                     From module . . . . . . . . :   DCXP8602
                                     From procedure  . . . . . . :   DCXP8602AB
                                    Statement . . . . . . . . . :   3
                                     Message . . . . :   Failed to accept connection request.
                                     Error found while attempting to accept a connection request. Review previous
                                       messages in joblog.
LCO0119    Information             00   02/29/16  11:51:19.098702  DCXS86XX     G14COMLIB   *STMT    *EXT                    *N
                                     From module . . . . . . . . :   DCXP8602
                                     From procedure  . . . . . . :   DCXP8602AB
                                     Statement . . . . . . . . . :   3
                                     Message . . . . :   Listener shutdown started.
                                     End job request received by the Listener program. Listener program will
                                       attempt to perform cleanup.
CPC2191    Completion              00   02/29/16  11:51:19.103565  QLIDLOBJ     QSYS        061B     LCOLIST     G14PGMLIB   *STMT
                                     To module . . . . . . . . . :   LCOLIST
                                     To procedure  . . . . . . . :   endJobCleanUp__FP18_CNL_Hndlr_Parms_T
                                     Statement . . . . . . . . . :   32
                                     Message . . . . :   Object G14COMLIB in QUSRSYS type *USRQ deleted.

One scenario that may cause this is if Host Monitor is started, but fails due to a licensing error. This may leave the socket connection active with a status of FIN-WAIT, even when the Listener is stopped.

The length of time that the port is locked appears to be dependant on the OS load and configuration and can be delayed for many minutes.

Solution:

The port will eventually be released, so currently the only solution is to wait for it to be available again.  Port usage can be monitored using the NETSTAT command and taking option 3.

LANSA is currently investigating other possible solutions.