The error
GurobiError: Too many sessions, X active sessions for a baseline of Y
occurs when you have exceeded your WLS (Web License Service) license's baseline number of sessions for an extended period.
A WLS session occupies a license token until the environment is closed AND the token lifespan has expired.
Resolving an active session overage
To reduce the number of active WLS sessions, you should identify and terminate any running excess sessions and wait for the associated tokens to expire. The excessive sessions might be caused by users or applications accidentally using or not releasing the license token.
To view your currently active sessions, navigate to the Sessions section of the Web License Manager. The Report section of the Web License Manager displays additional information about historical session usage. Note that it is not possible to revoke tokens or terminate usage sessions through the manager.
Prevention and best practices
Here are some best practices to avoid unintended open sessions using your WLS license:
- Implement proper session management in your applications to ensure that tokens are correctly released.
- Information on session management using Gurobi Environments (for all APIs) is included in the Session Boundaries section of the reference manual.
- Additional in-depth discussion and recommended code patterns for gurobipy can be found here: How do I manage Gurobi environments in gurobipy?
- Periodically monitor your session usage in the Web License Manager to identify and correct unexpected usage trends.
The token duration can be adjusted by modifying the WLSTokenDuration parameter, but the minimum (and default) value is 5 minutes. Each process occupies a license token until the token lifespan has expired.