Upgrade from 2017.1.3 to 2017.2.3 DB failure on Azure

I just upgraded my QA TeamCity from 2017.1.3 to 2017.2.3 via the Web UI. It fails while trying to upgrade the DB from version 812 to 829 with this error:

[2018-03-21 19:11:34,469] INFO - jetbrains.buildServer.STARTUP - Exclusive database lock was taken [2018-03-21 19:11:34,469] INFO - jetbrains.buildServer.STARTUP - Going to upgrade from version 812 to version 829 [2018-03-21 19:11:34,469] INFO - de.versioning.ConvertPerformer - Converter 813[do-nothing] starting... [2018-03-21 19:11:34,469] ERROR - jetbrains.buildServer.STARTUP - Exception UnknownUpgradeError in stage UPGRADE: Upgrading error: Connection reset by peer: socket write error
SQL exception: Connection reset by peer: socket write error jetbrains.buildServer.maintenance.exceptions.UnknownUpgradeError: Upgrading error: Connection reset by peer: socket write error
SQL exception: Connection reset by peer: socket write error at jetbrains.buildServer.maintenance.StartupProcessor.doUpgrade(StartupProcessor.java:432) at jetbrains.buildServer.maintenance.StartupProcessor$3.call(StartupProcessor.java:7) at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:86) at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStage(StartupProcessor.java:242) at jetbrains.buildServer.maintenance.StartupProcessor.processConcreteStageSafe(StartupProcessor.java:57) at jetbrains.buildServer.maintenance.StartupProcessor.processTeamCityLifecycle(StartupProcessor.java:246) at jetbrains.buildServer.maintenance.StartupProcessor.access$000(StartupProcessor.java:31) at jetbrains.buildServer.maintenance.StartupProcessor$1.run(StartupProcessor.java:3) at java.lang.Thread.run(Thread.java:748) Caused by: jetbrains.buildServer.serverSide.db.DBDisconnectedException: Connection reset by peer: socket write error
SQL exception: Connection reset by peer: socket write error at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1748) at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1732) at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:1842) at com.microsoft.sqlserver.jdbc.TDSWriter.flush(IOBuffer.java:4161) at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4062) at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3107) at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6700) at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6686) at com.microsoft.sqlserver.jdbc.SQLServerConnection$1ConnectionCommand.doExecute(SQLServerConnection.java:1834) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(SQLServerConnection.java:1839) at com.microsoft.sqlserver.jdbc.SQLServerConnection.setAutoCommit(SQLServerConnection.java:1979) at jetbrains.buildServer.serverSide.db.DBFunctions.setAutoCommit(DBFunctions.java:830) at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverter(ConvertPerformer.java:108) at jetbrains.buildServer.serverSide.versioning.ConvertPerformer.runConverters(ConvertPerformer.java:87) at jetbrains.buildServer.serverSide.versioning.VersionManager.upgradeIt(VersionManager.java:381) at jetbrains.buildServer.maintenance.StartupProcessor$UpgradePerformer.doUpgrade(StartupProcessor.java:3) at jetbrains.buildServer.maintenance.StartupProcessor$13.run(StartupProcessor.java:1) at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager$3.run(TeamCityDatabaseManager.java:905) at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager$3.run(TeamCityDatabaseManager.java:900) at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withMaintenanceDBF(TeamCityDatabaseManager.java:884) at jetbrains.buildServer.serverSide.db.TeamCityDatabaseManager.withMaintenanceDBF(TeamCityDatabaseManager.java:900) at jetbrains.buildServer.maintenance.StartupProcessor.doUpgrade(StartupProcessor.java:304) ... 8 more Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error ... 32 more

I found out that the jdbc connection string was different. TeamCity was using:

jdbc:sqlserver://blah-blah-blah-blah.database.windows.net:1433;databaseName=teamcity-db

And my Azure MSSQL database was asking me to use:

jdbc:sqlserver://blah-blah-blah-blah.database.windows.net:1433;database=teamcity-db

So I went into the C:\TeamCityData\config\database.properties and changed the connection string and restarted the TeamCity service and it all worked fine! By the way that is also the way to restart the maintenance process if you are stuck mid-upgrade scratching your head - restart the service.

1
4 comments

Thanks for the report! I've passed it along for investigation, as it sounds rather strange (we have tested quite a few upgrade scenarios and it has worked fine with them).

0
Avatar
Permanently deleted user

Had the same issue with upgrading from 2018.2.4 to 2019.1. The workaround above resolved the problem. Thanks for the post Anand.

1

Same as Ted - had problem upgrading 2018.2.4 to 2019.1.2. Workaround worked for me too!

0

I also had the same problem, upgrading from 2022.04.4 to 2022.10:

[2022-11-07 09:56:48,595]  ERROR -  jetbrains.buildServer.STARTUP - Exception UnknownUpgradeError in stage UPGRADE: Upgrading error: Connection reset by peer: socket write error: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error
jetbrains.buildServer.maintenance.exceptions.UnknownUpgradeError: Upgrading error: Connection reset by peer: socket write error: com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error

Workaround also worked for me.

0

Please sign in to leave a comment.