SAP Knowledge Base Article - Preview

1916333 - "FAIL: NIECONN_REFUSED" sapcontrol error due to agent.lock file


You receive a connection refused error like the one below when executing a sapcontrol function.

FAIL: NIECONN_REFUSED (Connection refused), NiRawConnect failed in

Checking in the OS level you can see that the port 5<instance number>13 is not up and the sapstartsrv streamfile /tmp/.sapstream5<instance number>13 does not exist. 

In the sapstartsrv_ccms.log file found in the /usr/sap/<SID>/<instance>/log/sapccm4x you can see the following entry as the latest one.

       INFO: Starting CCMS agent threads...
       INFO: Checking lock file ...

Also, using a UNIX debug tool (like truss, strace, pstack) and starting the sapstartsrv for this instance you see that the last entry is it trying to open the "agent.lock" file in the OS level.

       __semop(340787253, 0x0FFFFFFFFFFFAFC0, 1) = 0
       kopen("/usr/sap/<SID>/log/sapccmsr/agent.lock", O_RDONLY O_LARGEFILE)
       = 7
       kioctl(7, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY



  • Any SAP environment with sapstartsrv runnning and kernel 710 or above.
  • UNIX Operating System.
  • Not related to a particular DB or SAP Product.


SAP NetWeaver 7.0 ; SAP NetWeaver 7.3 ; SAP NetWeaver 7.4 ; SAP NetWeaver 7.5 ; SAP enhancement package 1 for SAP NetWeaver 7.0 ; SAP enhancement package 1 for SAP NetWeaver 7.3 ; SAP enhancement package 2 for SAP NetWeaver 7.0 ; SAP enhancement package 3 for SAP NetWeaver 7.0


NIECONN_REFUSED, Sapstartsrv, FAIL, CCMS, Hanging, Agent.lock, Agent down , KBA , BC-CST-STS , Startup Service , BC-CTS , Change and Transport System , Problem

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.