Issue with database out of no where...

ghosty6 years ago

So.... All of a sudden my Traccar (3.17) stopped to work :(

All I see in the wrapper log is this:

INFO|1251/0|Service traccar|18-11-16 08:42:19|[main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
INFO|1251/0|Service traccar|18-11-16 08:42:19|org.h2.jdbc.JdbcSQLException: Constraint "FK_POSITION_DEVICEID" already exists; SQL statement:
INFO|1251/0|Service traccar|18-11-16 08:42:19|ALTER TABLE PUBLIC.POSITIONS ADD CONSTRAINT PUBLIC.FK_POSITION_DEVICEID FOREIGN KEY(DEVICEID) INDEX PUBLIC.FK_POSITION_DEVICEID_INDEX_B REFERENCES PUBLIC.DEVICES(ID) ON DELETE CASCADE NOCHECK [90045-197]

Makes no sense as I done no changes on the server side, nor on traccar... Anyone faced this type of issue? Been searching a while for this and seems that happened once or twice to someone who upgraded his traccar server but I didn't touch any of it.

Anton Tananaev6 years ago

Upload somewhere full log.

ghosty6 years ago

Hi Anton,

Thank you for helping with this!
Here's the link for the full wrapper log
https://pastebin.com/3vKaLVN3

Anton Tananaev6 years ago

Looks like there is some problem with database migrations scripts. Why are you using H2 database? There is a very good chance that it just indicates that database is corrupted.

ghosty6 years ago

Oh man.... :( That's a shame! I'm gonna read some documentation to check if I can get access to the database and verify the contents and see where / if I can fix it.

Why I'm using H2.... That's a very good question. This Traccar server I have comes from the 3.1 version (or before... can't recall as it's so old! heh) and it started with that H2 database and I never thought about changing it.

Maybe I'll take the opportunity to switch over to MySQL or something....

Anton Tananaev6 years ago

Yes, for production I would definitely recommend to use some fully featured database engine like MySQL.

ghosty6 years ago

Thanks for giving it a look Anton. I'm going to work on that database to see if I can recover it (hopefully I'll do my magic and be able to do it) and if I do so I'll post here the info to help others that might come across the same situation.

Cheers!