database.updateLatestPosition error

jbosco7 years ago

Sometimes the last position of the device is left with an id that does not correspond to the last and is never updated. what can we do?

Anton Tananaev7 years ago

Are you sure you have checked the timestamp to make sure that it's not the latest one?

jbosco7 years ago

Sure, I have also reviewed the data in MySQL and I see that it has more records and in the field "devices-> positionid" is not the last of the records in the table "positions" for that device.

In fact, when this happens, the field is no longer refreshed unless I update them manually and restart the server

Anton Tananaev7 years ago

OK, can you please provide a screenshot of the "state" panel with device selected, and then the record that you expect to be the latest.

jbosco7 years ago

When it happens I put it

jbosco7 years ago

Has returned to happen, the field "devices-> positionid" is not the last position of the table "positions" for that device, sending photos to prove with SQL statements, also the date that you put when you click is not the Same and can not find it in the database.

Photo 1: Traccar Web Client. http://simj.simjcloud.com/index.php/s/28W9P3JCRllzDqK
SQL1 statements : http://simj.simjcloud.com/index.php/s/AvisUJMmcCncatv
SQL2 statements : http://simj.simjcloud.com/index.php/s/hYb3w9r6ToTrodd
SQL3 statements: http://simj.simjcloud.com/index.php/s/47tlgJrhEaGRrfS

Thanks you.

Anton Tananaev7 years ago

Have you checked timestamps as I asked you? In the state panel you have a position from year 2030, so obviously Traccar server considers it to be the "latest" comparing to others.

jbosco7 years ago

tracker-server.log 20170118

2017-01-18 09:39:16  INFO: [D57C869A] connected
2017-01-18 09:39:16 DEBUG: [BA354D44: 5027 < 31.4.211.48] HEX: 00000000000001130809000001b9771ee92000fd25d3021690797600820078050026fa0101fa01000000000001b9771ee15000fd25cefe16907b5e0081007905002500000000000000000159b0bad39800fd27009e169077710077003607002400000000000000000159b0ba990000fd26c6c716905d090079004408002800000000000000000159b0ba5e6800fd26788c169052750079005b08002c00000000000000000159b0ba23d000fd26211b16905e19007b006b07003000000000000000000159b0b58c0800fd25ccf7169081ce0073013008001a00000000000000000159b0adfe7000fd261b5c16909ca3006a00c308000500000000000000000159b0adc3d800fd2627031690b0bd006900d20900190000000000000900008789
2017-01-18 09:39:16 DEBUG: [BA354D44: 5027 > 31.4.211.48] HEX: 00000009
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:33:25, lat: 37.85692, lon: -4.78543, speed: 14.0, course: 304.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:25:10, lat: 37.85760, lon: -4.78343, speed: 2.7, course: 195.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:38:26, lat: 37.85600, lon: -4.78328, speed: 25.9, course: 107.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:38:56, lat: 37.85598, lon: -4.77904, speed: 21.6, course: 68.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2030-01-31 09:38:12, lat: 37.85670, lon: -4.78528, speed: 20.5, course: 120.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2030-01-31 09:38:10, lat: 37.85675, lon: -4.78538, speed: 20.0, course: 121.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:38:41, lat: 37.85570, lon: -4.78104, speed: 23.8, course: 91.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:39:11, lat: 37.85665, lon: -4.77756, speed: 19.4, course: 54.0
2017-01-18 09:39:16  INFO: [BA354D44] id: 356307042807866, time: 2017-01-18 09:24:55, lat: 37.85812, lon: -4.78313, speed: 13.5, course: 210.0
Anton Tananaev7 years ago

What version of Traccar are you using?

jbosco7 years ago

3.9

Anton Tananaev7 years ago

Looks like your device sends some incorrect data. I would recommend contacting your vendor and reporting this issue.

jbosco7 years ago

In the database in the table "positions" there is no record with the year 2030

jbosco7 years ago

Yes, but as I could always get the data sent by the device and set the date of the system and is already fixed

jbosco7 years ago

This is my configuration:

    <entry key='database.insertPosition'>
        INSERT INTO positions (deviceId, protocol, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, attributes)
        VALUES (:deviceId, :protocol, :now, :now, :now, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :attributes)
    </entry>

I set "servertime", "devicetime" and "fixtime" to "now"

Anton Tananaev7 years ago

Even if in the database everything is fine, internally the date is still incorrect. Traccar has a cache of latest position for every device.