The purpose of this wiki is to provide troubleshooting tips if RFC connections remain in transaction SM04.
This wiki provides details on how to identify problem connections, check the date and time the connection was last used and identify parameters and notes that may resolve the issue.
Identifying the issue
If you suspect RFC connections are not being logged off check SM04, it should show many RFC connections
The last request time will be shown here but to verify the last request date choose the relevant entry in SM04 then goto "User" in the Menu and then "Technical Information":
The date and time of the last request will be shown in the field modeinfo0.diatime, for example:
Note 568271 describes the "lifetime of an RFC connection".
The note indicates that whoever opens the RFC connection must also close it. It is up to the application that opened the connection to close it when it has finished.
According to this note it is the responsibility of RFC caller to close the connection. A client program opens the connection for calling funtion module(s) and has to close this connection,
as soon as this connection is in use any more.
On the R/3 side the connections are kept for the total time where the client transaction is active.
Most applications choose not to do any special handling and so the system defaults to keeping the RFC connection
open as long as the context (ie. transaction) is active to avoid re-authentication and session establishment.
Thus, RFC connections are held until a transaction is finished. This is the way that RFC connections were designed to work. The RFC connectiondoes not close until the transaction is exited.
This is because of performance issues, since setting up a connection and its server side session is time/space consuming.
For external RFC clients, such as C- or visual basic programs, the programmer has to close the connection via RfcClose function. If the client side opens then connection it is also up to them to close
To find out exactly which function module is being used Note 780817 "Analyzing the RFC user in SM04" is very useful
If problems occur when using the Visual Composer please check the solution on note 1254158 Visual Composer doesn't close RFC connections with backend.
In relation to portal connectons please see the following part of note 1507034:
"RFC connections from the Portal will remain after logoff The sessions in the backend remain alive while the connection remains in the free connections j2ee pool.
To reduce the time that the connections remain open, you can decrease the connection lifetime following SAP Note 809954:
Go to Visual Admin -> server -> services -> Connector Container ->com.sapportals.connectors.sap -> SAPFactory -> Managed Connection
Factory -> Connection Definition, and set the Connection Lifetime to, for example 60 (or even less).
This will mean that after 60 seconds, open connections will be released from the pool and the session in the backend will be closed (do not set Connection Lifetime to 0, it means the Connection lifetime never expires)."
User NO-USER shown in SM04
I have seen in previous cases that is user NO_USER is shown in SM04 this may be related to some kind of monitoring agent, for example CCMS agents. If there is a blank line in SM04 with no user and no type, it represents a connection which exists but is not established because no user is logged in. For information on blank rows in SM04 see note:
1040464 Blank row in SM04
To test if it the NO-USER connections are related to monitoring, try deactivating CCMS agents and see if the user remains in transaction SM04.
Related SAP notes/KBA's
Note 900132 Remaining user contexts, remaining locks
Note 1261669 RFC connections are not closed
Note 864455 SosGetAnchor error message relating to SNC and BEx
Note 1660720 Session remains open after the logoff on enterprise portal.
Note 1731719 Hanging RFC connections
Note 1644347 HttpClientSessionListener failed to destroy client session
Note 1791529 GW: Hanging connections between J2EE and gateway
Note 1870623 -This note is currently "In process" but will be available in the coming weeks.
Note 1557494 User cannot be logged off from system