Traccar server not starting on reboot

odhiambo4 months ago

I am running traccar on FreeBSD, controlling it via supervisord.
Sometimes when I reboot the server, traccar refuses to start and enters a restarting loop, with the following repeatedly appearing in the log:

2024-07-09 10:44:41 ERROR: Main method error - Database is in a locked state. It could be due to early service termination on a previous launch. To unlock you can run this query: 'UPDATE DATABASECHANGELOGLOCK SET locked = 0'. Make sure the schema is up to date before unlocking the database. - DatabaseLockException (DatabaseModule:102 < <gener:-1 < *:-1 < ... < MainModule:128 < ...)
2024-07-09 10:44:44  INFO: Operating system name: FreeBSD version: 14.1-RELEASE architecture: amd64
2024-07-09 10:44:44  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: OpenJDK BSD Porting Team version: 19.0.2+7-1
2024-07-09 10:44:44  INFO: Memory limit heap: 1024mb non-heap: 0mb
2024-07-09 10:44:44  INFO: Character encoding: UTF-8
2024-07-09 10:44:44  INFO: Version: 6.2
2024-07-09 10:44:44  INFO: Starting server...
2024-07-09 10:44:44  INFO: HikariPool-1 - Starting...
2024-07-09 10:44:44  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@402f80f5
2024-07-09 10:44:44  INFO: HikariPool-1 - Start completed.
2024-07-09 10:44:44  INFO: Clearing database change log checksums
2024-07-09 10:44:44  INFO: Waiting for changelog lock....
2024-07-09 10:44:55  INFO: Waiting for changelog lock....

I have then have to do a 'supervisorctl stop traccar && supervisorctl start traccar' for the service to start and it gives:

2024-07-09 10:49:19  INFO: Operating system name: FreeBSD version: 14.1-RELEASE architecture: amd64
2024-07-09 10:49:19  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: OpenJDK BSD Porting Team version: 19.0.2+7-1
2024-07-09 10:49:19  INFO: Memory limit heap: 1024mb non-heap: 0mb
2024-07-09 10:49:19  INFO: Character encoding: UTF-8
2024-07-09 10:49:19  INFO: Version: 6.2
2024-07-09 10:49:19  INFO: Starting server...
2024-07-09 10:49:19  INFO: HikariPool-1 - Starting...
2024-07-09 10:49:20  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@402f80f5
2024-07-09 10:49:20  INFO: HikariPool-1 - Start completed.
2024-07-09 10:49:20  INFO: Clearing database change log checksums
2024-07-09 10:49:20  INFO: Waiting for changelog lock....

So my question is, how do I address the given error:

2024-07-09 10:44:41 ERROR: Main method error - Database is in a locked state. It could be due to early service termination on a previous launch. To unlock you can run this query: 'UPDATE DATABASECHANGELOGLOCK SET locked = 0'

Thank you.

Anton Tananaev4 months ago

The error message is telling you how to solve it.