SQL Server Memory Leak?

We upgraded from 2017.2 and are now running the latest TeamCity (v2019) on a windows machine with the agent and server running as a service.

The server connects to a MS SQL 2016 instance.

When running, the SQL activity monitor shows 5 TeamCity applications/connections running. The memory usage for each session continues to grow. Over time this begins to negatively affect other database queries. At one time the connection(s) were using upwords of 1GB of memory each within SQL. with no active builds going on.

This happened in the 2017.2 version and is still happening in the 2019 version. If we restart the server service everything refreshes and the memory drops to 0 and then starts to grow again.

Please note we only have about 7 projects in TeamCity that build roughly once a week at most.

Is this a memory leak or is there a setting that tells teamcity to close its connections that I am missing?




Comment actions Permalink

There are some older versions of the JDBC Drivers that are known to have memory issues. As a first step, can you tell me what version of JDBC Driver you have installed? Your driver can be found in <TeamCity Data Directory>\lib\jdbc.

Comment actions Permalink

Eric thank you for the response

There is a JAR file of sqljdbc42.jar. (last modified 11/17/2015)

There is also a Native folder and within that a "windows-i386" folder. They look empty though

Comment actions Permalink

Based on the last modified date, it sounds like you're using a fairly old version of the JDBC driver. There are known memory leaks in some of the older drivers and anything older than version 6.0 is no longer supported by MS (as of 2018). I would recommend updating to a newer version following the process found here in our documentation: https://www.jetbrains.com/help/teamcity/setting-up-teamcity-with-ms-sql-server.html#SettingupTeamCitywithMSSQLServer-SetupJDBCDriverforSQLServerdatabase

Be sure to check the Microsoft documentation to verify which version is recommended for compatibility with your MS SQL 2016 installation. Additionally, since you don't know exactly which version of the driver you have, I would also recommend retaining a copy of your current sqljdbc42.jar; just in case you need to roll back for some unforeseen reason.

Once you've updated your JDBC driver, let me know if the problem persists.

We actually have an entry in our YouTrack for what is probably your issue. Feel free to check it out. Our YouTrack is public and we use these entries to determine which features and changes make it into future versions of our software. https://youtrack.jetbrains.com/issue/TW-55855

Comment actions Permalink


Thank you very much! 

We upgraded the JDBC Driver to 6.4  (mssql-jdbc-6.4.0.jre8.jar) and so far memory usage has remained stable.


Please sign in to leave a comment.