"Attempt to start more than one TeamCity server" after upgrade to 10.0

Answered

I'm running TeamCity in a Dokku/Docker container. It's run against a persistent MySQL instance.

In 9.1.x version I used this script to restart an instance: `dokku ps:stop teamcity ; sleep 60 ; dokku ps:start teamcity`

Sleep successfully eliminated `Attempt to start more than one TeamCity server connected to the same database.` problem.

 

Looks like after update to 10.0 even a sleep of 300 does not solve a problem.

6 comments

There should be something that prevents TC from shutting down. Please try to stop TC, wait a minute, then grab and attach teamcity-server.log and thread dump that is mentined in the end of the log (if any).

0

I do not try to stop a TC server. I bring down a VM with a TC instance. I'm reasonably sure that the previous TC instance is no longer running.

0

Please attach teamcity-server.log

 

0

Sure! Looks like there is no way to attach a log file here.

 

[2016-07-22 20:49:20,261] INFO - jetbrains.buildServer.STARTUP - Path to the startup configuration file: /opt/TeamCity/bin/../c
onf/teamcity-startup.properties
[2016-07-22 20:49:20,474] INFO - jetbrains.buildServer.STARTUP -

 

 


[2016-07-22 20:49:20,475] INFO - jetbrains.buildServer.STARTUP - ===========================================================
[2016-07-22 20:49:20,475] INFO - jetbrains.buildServer.STARTUP - Starting TeamCity server
[2016-07-22 20:49:21,365] INFO - jetbrains.buildServer.STARTUP - TeamCity version: 10.0 (build 42002), data format version 787
[2016-07-22 20:49:21,376] INFO - jetbrains.buildServer.STARTUP - OS: Linux, User: root, Java: 1.8.0_91, OpenJDK 64-Bit Server V
M (25.91-b14, mixed mode), OpenJDK Runtime Environment (1.8.0_91-8u91-b14-1~bpo8+1-b14), Oracle Corporation
[2016-07-22 20:49:21,376] INFO - jetbrains.buildServer.STARTUP - JVM parameters: -Djava.util.logging.config.file=/opt/TeamCity/
conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xmx512m -Dteamcity.configuration.path=.
./conf/teamcity-startup.properties -Dlog4j.configuration=file:/opt/TeamCity/bin/../conf/teamcity-server-log4j.xml -Dteamcity_logs=
../logs/ -Djava.awt.headless=true -Djava.endorsed.dirs=/opt/TeamCity/endorsed -Dcatalina.base=/opt/TeamCity -Dcatalina.home=/opt/T
eamCity -Djava.io.tmpdir=/opt/TeamCity/temp
[2016-07-22 20:49:21,377] INFO - jetbrains.buildServer.STARTUP - Garbage collection: PS Scavenge, PS MarkSweep
[2016-07-22 20:49:21,379] INFO - jetbrains.buildServer.STARTUP - Web server version: Apache Tomcat/7.0.68
[2016-07-22 20:49:21,379] INFO - jetbrains.buildServer.STARTUP - Server IP address: 172.17.0.19
[2016-07-22 20:49:21,383] INFO - jetbrains.buildServer.STARTUP - Web server ports: 5000 (protocol: org.apache.coyote.http11.Htt
p11NioProtocol, scheme: http), 8105 (shutdown port)
[2016-07-22 20:49:21,384] INFO - jetbrains.buildServer.STARTUP - TeamCity server work mode: Main TeamCity Server
[2016-07-22 20:49:21,391] INFO - jetbrains.buildServer.STARTUP - Version file lock was successfully obtained: /opt/TeamCity/webapps/ROOT/BUILD_42002
[2016-07-22 20:49:21,477] INFO - jetbrains.buildServer.STARTUP - Servlet real path: /opt/TeamCity/webapps/ROOT/
[2016-07-22 20:49:21,492] INFO - jetbrains.buildServer.STARTUP - Current stage: Looking for the TeamCity Data Directory
[2016-07-22 20:49:21,492] INFO - jetbrains.buildServer.STARTUP - The TeamCity Data Directory path is determined using the envir
onment variable TEAMCITY_DATA_PATH
[2016-07-22 20:49:21,507] INFO - jetbrains.buildServer.STARTUP - The TeamCity Data Directory "/data/teamcity" exists
[2016-07-22 20:49:21,510] INFO - jetbrains.buildServer.STARTUP - The main configuration file "/data/teamcity/config/main-config
.xml" exists
[2016-07-22 20:49:21,511] INFO - jetbrains.buildServer.STARTUP - The database properties file "/data/teamcity/config/database.properties" exists
[2016-07-22 20:49:21,511] INFO - jetbrains.buildServer.STARTUP - The internal database data file "/data/teamcity/system/buildse
rver.data" doesn't exist
[2016-07-22 20:49:21,527] INFO - jetbrains.buildServer.STARTUP - Data Directory version: 727
[2016-07-22 20:49:21,534] WARN - jetbrains.buildServer.STARTUP - The Data Directory contains non-TeamCity files or directories
[2016-07-22 20:49:21,534] INFO - jetbrains.buildServer.STARTUP - Current stage: Looking for the database configuration
[2016-07-22 20:49:21,535] INFO - jetbrains.buildServer.STARTUP - Database properties file "/data/teamcity/config/database.prope
rties" exists
[2016-07-22 20:49:21,536] INFO - jetbrains.buildServer.STARTUP - Internal HSQL database file (/data/teamcity/system/buildserver
.data) doesn't exist
[2016-07-22 20:49:21,536] INFO - jetbrains.buildServer.STARTUP - Database connection URL: jdbc:mysql://dokku-mysql-teamcity/tea
mcity
[2016-07-22 20:49:21,537] INFO - jetbrains.buildServer.STARTUP - Using database connection URL from the database properties fil
e. The URL is: jdbc:mysql://dokku-mysql-teamcity/teamcity
[2016-07-22 20:49:21,538] INFO - jetbrains.buildServer.STARTUP - Using external (MYSQL) database
[2016-07-22 20:49:21,539] INFO - jetbrains.buildServer.STARTUP - Current stage: Connecting to the database
[2016-07-22 20:49:21,542] INFO - jetbrains.buildServer.STARTUP - JDBC loader: loading JDBC drivers (for the first time)
[2016-07-22 20:49:22,823] INFO - ide.db.TeamCityDatabaseManager - Database character set: latin1_swedish_ci
[2016-07-22 20:49:22,823] INFO - ide.db.TeamCityDatabaseManager - Database collation: latin1_swedish_ci
[2016-07-22 20:49:22,904] INFO - jetbrains.buildServer.STARTUP - JDBC driver version: 5.1 (MySQL Connector Java)
[2016-07-22 20:49:22,905] INFO - jetbrains.buildServer.STARTUP - Database system version: 5.6.26 (MySQL)
[2016-07-22 20:49:22,905] INFO - jetbrains.buildServer.STARTUP - Connected to the database successfully
[2016-07-22 20:49:22,905] INFO - jetbrains.buildServer.STARTUP - Current stage: Checking the database
[2016-07-22 20:49:23,162] INFO - jetbrains.buildServer.STARTUP - Database contains 122 tables.
[2016-07-22 20:49:23,174] INFO - jetbrains.buildServer.STARTUP - Database version is 727
[2016-07-22 20:49:23,176] INFO - jetbrains.buildServer.STARTUP - Upgrade from version 727 to version 787 is required
[2016-07-22 20:49:23,176] INFO - jetbrains.buildServer.STARTUP - Backup of this version is possible
[2016-07-22 20:49:23,199] INFO - etbrains.buildServer.HEARTBEAT - Attempting to capture the DB lock. My session starting code: 243850368
[2016-07-22 20:49:23,271] INFO - etbrains.buildServer.HEARTBEAT - Revealed a concurrent competitor: Session 1279024174 with node
id MAIN_SERVER started at 2016-07-14 19:26:09.0 in mode WORK from (172.17.0.17, null, main_server, null, Apache Tomcat/7.0.59, ve
rsion null, build null) last updated at 2016-07-22 20:48:26.0.
[2016-07-22 20:49:24,292] INFO - etbrains.buildServer.HEARTBEAT - Our session record has been deleted by Session 1279024174 with
node id MAIN_SERVER started at 2016-07-14 19:26:09.0 in mode WORK from (172.17.0.17, null, main_server, null, Apache Tomcat/7.0.5
9, version null, build null) last updated at 2016-07-22 20:48:26.0.
[2016-07-22 20:49:24,293] WARN - ide.db.TeamCityDatabaseManager - Another TeamCity server is working with this database: Session
1279024174 with node id MAIN_SERVER started at 2016-07-14 19:26:09.0 in mode WORK from (172.17.0.17, null, main_server, null, Apache Tomcat/7.0.59, version null, build null) last updated at 2016-07-22 20:48:26.0.
[2016-07-22 20:49:24,294] INFO - jetbrains.buildServer.STARTUP - The database lock can't be taken, database is used by another
server: Session 1279024174 with node id MAIN_SERVER started at 2016-07-14 19:26:09.0 in mode WORK from (172.17.0.17, null, main_se
rver, null, Apache Tomcat/7.0.59, version null, build null) last updated at 2016-07-22 20:48:26.0.
[2016-07-22 20:49:24,295] ERROR - jetbrains.buildServer.STARTUP - Attempt to start more than one TeamCity server connected to th
e same database.
[2016-07-22 20:49:24,295] INFO - jetbrains.buildServer.STARTUP - Current stage: TeamCity server startup error
[2016-07-22 20:49:24,295] INFO - jetbrains.buildServer.STARTUP - Administrator can login from web UI using authentication token
: 4227889443292834657
[2016-08-02 20:58:35,183] INFO - jetbrains.buildServer.STARTUP - Successful authentication token entry from IP address: /172.17
.0.1

 

 

 

0

So you didn't shutdown another server working on 172.17.0.17

0

Yep, you're right. It was a problem on my side.

I had a VM container running which I was not aware of. Shutting down all of them and restarting only required ones fixed a problem.

0

Please sign in to leave a comment.