Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Terminate a Junos XML Protocol Session

date_range 14-Jul-21

In a Junos XML protocol session, a client application’s attempt to lock the candidate configuration can fail because another user or application already holds the lock. In this case, the Junos XML protocol server returns an error message that includes the username and process ID (PID) for the entity that holds the existing lock:

content_copy zoom_out_map
<rpc-reply xmlns="URN" xmlns:junos="URL">
    <xnm:error>
        <message>
            configuration database locked by:
user terminal (pid PID) on since YYYY-MM-DD hh:mm:ss TZ, idle hh:mm:ss
            exclusive [edit]
        </message>
    </xnm:error>
</rpc-reply>

If the client application has the Junos OS maintenance permission, it can end the session that holds the lock by emitting the <kill-session> and <session-id> tag elements in an <rpc> element. The <session-id> element specifies the PID obtained from the error message:

content_copy zoom_out_map
<rpc>
    <kill-session>
        <session-id>PID</session-id>
    </kill-session>
</rpc>

The Junos XML protocol server confirms that it has terminated the other session by returning the <ok/> tag in the <rpc-reply> tag element:

content_copy zoom_out_map
<rpc-reply xmlns="URN" xmlns:junos="URL">
    <ok/>
</rpc-reply>

We recommend that the application include logic for determining whether it is appropriate to terminate another session, based on factors such as the identity of the user or application that holds the lock, or the length of idle time.

When a session is terminated, the Junos XML protocol server that is servicing the session rolls back all uncommitted changes that have been made during the session. If a confirmed commit is pending (changes have been committed but not yet confirmed), the Junos XML protocol server restores the configuration to its state before the confirmed commit instruction was issued. For information about the confirmed commit operation, see Committing the Candidate Configuration Only After Confirmation Using the Junos XML Protocol.

external-footer-nav