Upgrading to TeamCity 9.x: the JRE headaches

Today I updated our TeamCity server from 8.15 to 9.17. We need to support C# 6.0 so it’s an essential move. TeamCity 10 is still EAP and we would wait a couple of months after it comes out to make sure all the plugins are supported.

The installation was a breeze – the installer detected there was a previous version and offered to uninstall it. All good. Until there was a browser window opened so I can continue the configuration, but http://localhost/ only returned time out.

When I opened the Service Management (services.msc), it looked like the service was not running. I tried to start it, but then it stopped immediately. Events viewer was not exactly helpful, it gave a very obscure information:

The description for Event ID 404 from source TeamCity (see below) cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

===============================================================
TeamCity JetBrains JetService v1.1.755.777
c:\TeamCity\bin\TeamCityService.exe
Service process exited without service stop request
===============================================================

Then I looked to logs folder in TeamCity, teamcity-winservice.log was updated recently, and it shed a light on what’s wrong:

[2016-05-24 16:50:44,898] ProcessCommand [Info] Process exited with code: 1
[2016-05-24 16:50:44,985] console [Info] Error: Could not create the Java Virtual Machine.
[2016-05-24 16:50:44,985] console [Info] Error: A fatal exception has occurred. Program will exit.
[2016-05-24 16:50:44,985] console [Info] Invalid maximum heap size: -Xmx4g
[2016-05-24 16:50:44,985] console [Info] The specified size exceeds the maximum representable size.
[2016-05-24 16:50:44,985] ServiceExecuteProcessTask [Error] Service process exited without service stop request

The reason was TeamCity 9.x comes with Java 8 bundled, and it’s 32-bit version – you don’t have the option choose 64-bit version when download. The older version was configured to run with Java 64-bit, thought. When TeamCity tries to run, it has this error: Invalid maximum heap size: -Xmx4g

This was one of the system variables which were added when we installed TeamCity 8.x. The solution? Remove that from that system variables.

And now the service can be started normally. And after couple of minutes of upgrading database and such, it’s working again.

C# 6.0, here we come.

One thought on “Upgrading to TeamCity 9.x: the JRE headaches

Leave a Reply

Your email address will not be published. Required fields are marked *