License management and troubleshooting
Introduction
Administrators face many license management challenges that can interfere with user productivity and software ROI. While these challenges aren’t specific to Klocwork Insight—they're common across the software industry—we recognize your frustration.
In the interests of helping your organization deploy Klocwork Insight and realize the benefits of source code analysis as quickly as possible, we’ve collected conceptual and how-to information about licensing into this one article.
Specifically, this article discusses:
- high-level information about the Klocwork license file,
- types of Klocwork licenses,
- prevention strategies and customization considerations,
- handy Flexera license management tools installed with Klocwork Insight,
- and troubleshooting tips to solve and minimize user disruption.
About Klocwork licenses
Klocwork license file
Klocwork Insight uses FLEXlm licensing from Flexera Software (formerly Macrovision). A Klocwork license file is locked to your license manager server. You may use your own FLEXlm server or the License Server included in the Klocwork Server package.
To get your license from Klocwork Customer Support, simply provide the FLEXlm host ID, which you obtain by running lmhostid after you install the Klocwork Server package, as well as the host name of the machine where you installed the Klocwork License Server (or from your own FLEXlm server).
The license file contains information about your license server configuration, as well as what Klocwork products and features you are licensed to use.
When you have your license file, place it in the projects_root/licenses directory and start your Klocwork Servers.
Types of licenses
Specifically, the license file will indicate how many build and user licenses you purchased. Build licenses are used to run the Klocwork integration build analysis on a build server. Build licenses are node-locked to a host name or “fixed”. A fixed build license has a long linger period, generally two weeks (1,209,600 seconds).
User licenses are for Insight client tools, such as Klocwork Review and IDE plug-ins. Two types of user licenses are available: "individual" and "global". An "individual" license is one that has a longer linger time, generally 24 hours. A "global" license has a shorter linger time, generally 10 minutes. "Linger" is the amount of time after the last use of a license before it is free for another user to check out. Note that these linger times start at the end of the inactivity time-outs that some Klocwork components have.
References:
Prevention strategies and customization considerations
The right licensing mix is determined by the size of your organization. Sounds simple, right? But there are a number of customizations you can consider to get the most out of the licensing you have in place and minimize user disruptions.
Perhaps your workforce is growing and you need to re-jig your mix of build and user licenses. Feel free to contact Klocwork Customer Support (support@klocwork.com). They can get you started on the right licensing path and prevent future problems down the road.
What are your options? Here are some scenarios to consider:
Using your own FLEXlm server
If you will use your organization's FLEXlm license server rather than the license server packaged with Klocwork Insight, you must configure Insight and the FLEXlm license server to work together, and you must put your Klocwork license file in the right place.
Insight supports version 10.8.2.1 or greater of lmgrd, the FLEXlm license manager daemon.
Read more at Using your organization’s FLEXlm server.
Adjusting FLEXLM_TIMEOUT
Large, multi-national organizations may want to tweak the licensing timeout period to better accommodate overseas users of client tools.
If the machine consuming a license (for example, using kwcheck or kwbuildproject) is a Windows machine and the configured port is in the 27000-27009 range, you can set the FLEXLM_TIMEOUT system variable to 10000000 microseconds. This is the more typical value, but you can set the value to 30000000 microseconds for networks with long delays.
Reserving licenses
You can reserve licenses to set up a combination that enables certain people to always have access to a user license or that a particular server always has access to a build license.
This type of customization is more typical for large deployments where there’s a separation between the roles of the Klocwork administrator and the Klocwork user.
Reserving licenses requires an options file. For more information, see Reserving licenses.
If your License Server changes
If you need to change any aspect of a server's network setup that will affect its IP address and/or its fully qualified host name:
- Stop the Klocwork Servers
- Make a backup copy of your license file
- Edit the license file to change the host name or IP address to the new host name or IP address
Note: You can change the host name, but not the host ID of the License Server - Communicate the changes to client tool users
Tip: Some customers have their client tool users (particularly those on Windows), uninstall the User packages and re-install the User packages, adding the updated hosts and ports during the installation process. The desktop shortcuts to Klocwork Review and the installed help are then updated automatically to point to the correct host and port.
For more information, see Viewing and changing Klocwork server settings
Handy license management tools
Flexera license management utilities are installed with the Klocwork Server package in the 3rdparty/bin directory.
Three license management tools that we use a lot here at Klocwork are explained below.
lmhostid
Returns the FLEXlm ID for your machine. The ID is a unique alpha-numeric string. Remember how we said that your license file is locked to your license manager server? Well, this command returns the host ID you need to provide to support to get your license file.
Here's an example of what to provide to the support team to get your license file:
- license server host name: klocwork01.company.com
- license server host ID: ac23e8f97616
If lmhostid returns more than one host ID, run ipconfig /all on Windows or ifconfig on Unix to get more information. Select the ID associated with your Local Area Connection (NOT wireless).
For more information, see Getting a license.
lmstat
Checks how many licenses you have in use. You can check license use by feature (Klocwork component).
Example:
lmstat -c 27000@klocwork01.company.com -f review
where
- -c specifies the License_Server_port@License_Server_host
- -f refers to the Klocwork feature (or component), which in this case is Klocwork Review; a complete list of possible features for build and user licenses are below:
Build
- kwadmin
- kwbuildproject
- kwinspectreport
Client
- kwcheck
- architect
- codereview
- review
- kwstackoverflow
- plugin.eclipse
- plugin.idea
- plugin.msvs
- kwcheck
- refactoring
For more information, see Finding out how many licenses are in use.
lmswitch
Keeps license.log files from becoming too large. You can run the lmswitch command automatically using the Windows Task Scheduler or a cron job on Unix.
For more information, see Switching the licensing debug log to reduce file size.
Troubleshooting licensing
Check the license log file
For licensing issues, you can always pull more information from error messages in the log file. If you are not running a corporate license server, the log file is located in <projects_root>/logs/license.log.
If you are running a corporate license server, look at the logs on that server to determine the cause of the failure.
Can’t connect to License Server
Strategies for dealing with the error message, "Can't Connect to License Server (-15)" are provided in this wiki article, Can’t connect to License Server.
No Klocwork plug-in license available (out of licenses?)
The cause may simply be that the License Server isn’t running, which is one of the possible scenarios discussed in the above linked article.
Other possible causes are:
- The desktop user has the wrong License Server settings configured. Information about how to access License Server settings in Visual Studio, Eclipse, IntelliJ IDEA, Klocwork Desktop and kwcheck are provided in Desktop licensing problems.
- The user may need to wait until a license is returned by another user. For more information about inactivity time-out periods, see Why can’t I get a license?
- All licenses are in use and more licenses are required for your team or organization. To see how many licenses are in use, use the FLEXlm tool lmstat, which is installed with the Server package. For more information, see Finding out how many licenses are in use. If you need more licenses, contact Klocwork Support at support@klocwork.com.
- A license is stuck and has not been returned to the pool of available licenses because one of the Insight tools terminated unexpectedly. See Releasing stuck licenses.
Default License Server and vendor daemon ports not open
The License Server requires two ports to be opened on a server: the License Server port (default 27000) and the vendor daemon port (default 33133).
1. Verify that the License Server port is open:
telnet <license_server_host_name> 27000
2. If the connection is refused, have your IT person verify that the port is open for connection and also that the lmgrd license server is actually listening on this port. If the port is not available, get your IT admin to open the port. If the port is not available because of a firewall, then run the License Server on another port other than 27000. See Viewing and changing Klocwork Server settings.
3. Verify that the vendor daemon port is open:
telnet <license_server_host_name> 33133
4. If the connection is refused, have your IT person verify that the port is open for connection and also that the Klocwork license daemon is actually listening on this port. If the port is not available, get your IT admin to open the port. If the port is not available because of a firewall, then you need to edit your license file. See Changing the vendor daemon port in your license file.
License Server not running because of host ID mix-up
Klocwork license files are host ID specific. If the License Server is not running because the license file was placed on a machine that has a different host ID than the one identified in the license file, you must either:
- Put the license file on the machine for which it was intended, or
- Contact Klocwork Support (support@klocwork.com) and provide the host ID of the machine, so you can be issued a new license file.
If the problem is a host ID mix-up, then the error in your license.log will look something like this:
14:08:48 (klocwork) Wrong hostid on SERVER line for license file: 14:08:48 (klocwork) ./projects_root/licenses/license.lic 14:08:48 (klocwork) SERVER line says xxxxxxx, hostid is yyyyyyyyyyyy 14:08:48 (klocwork) Invalid hostid on SERVER line



