Why am I unable to immediately restart the network license manager after stopping it on Linux?

17 views (last 30 days)
When my network license manager crashes or I stop the process, I am unable to immediately restart the network license manager. I am seeing errors similar to the following in my log file:
14:03:20 (lmgrd) The TCP port number in the license, 27200, is already in use.
14:03:20 (lmgrd) Possible causes:
14:03:20 (lmgrd) 1) The license server manager (lmgrd) is already running for this license.
14:03:20 (lmgrd) 2) The OS has not "cleared" this port since lmgrd died.
14:03:20 (lmgrd) 3) Another process is using this port number (unlikely).
14:03:20 (lmgrd) Solutions:
14:03:20 (lmgrd) 1) Make sure lmgrd and all vendor daemons for this
14:03:20 (lmgrd) license are not running.
14:03:20 (lmgrd) 2) You may have to wait for the OS to clear this port.
14:03:20 (lmgrd) Retrying for about 5 more minutes
14:03:38 (lmgrd) Still trying...
14:03:56 (lmgrd) Still trying...
OR
13:31:30 (lmgrd) Failed to open the TCP port number in the license.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 11 Apr 2019
Edited: MathWorks Support Team on 11 Apr 2019
When a process that is listening on a TCP port on Linux crashes or is killed, the kernel will place the port into a TIME_WAIT state for a short duration. This TIME_WAIT state prohibits any other process from opening a socket on that port.
There are a couple of reasons for the kernel to place the port in this state:
1. To prevent delayed segments from the previous connection being accepted into the new connection.
2. To ensure that connections from the client systems have been closed.
TIME_WAIT is implemented for good reason; it is best to wait until the port has cleared before restarting the network license manager. The amount of time needed for the port to clear should be insignificant. It is possible, however, to launch lmgrd in such a way as to ignore the TIME_WAIT state imposed by the kernel. You can launch lmgrd with a –reuseaddr flag which allows the server to explicitly bind to a same port, ignoring the TIME_WAIT state. The syntax for launching lmgrd like this would be:
lmgrd –c /path/to/license/file –l /path/to/log/file –reuseaddr

More Answers (0)

Categories

Find more on Manage Products in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!