Hi
I'm running Traccar Server 4.2 on my own Windows server, absolutely standard configuration except the database is MySQL 5.6 and I add devices programmatically. It has all been working fine except today I couldn't get my phone running Traccar Client (device id 645714) to log fixes.
Looking at the log I found that the server was reporting 645714 as an unknown device. I checked everything I could think of including the tc_devices table and everything looked good. In desperation I restarted the server and straightaway it recognised the device.
Log entries before and after the restart are:
Before restart
2018-12-28 13:40:18 INFO: [e0fbb7fc: 5055 < 82.29.218.147] HEX: 504f5354202f3f69643d3634353731342674696d657374616d703d31353436303034313135266c61743d35302e3738313834323334266c6f6e3d2d302e39343033323230362673706565643d302e302662656172696e673d302e3026616c7469747564653d35332e302661636375726163793d302e3026626174743d36322e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420382e302e303b204f4e45504c5553204133303033204275696c642f4f5052312e3137303632332e303332290d0a486f73743a207361696c6576656e742e6e65743a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2018-12-28 13:40:18 WARN: Unknown device - 645714 (82.29.218.147)
Before restart decoded
POST /?id=645714×tamp=1546004115&lat=50.78184234&lon=-0.94032206&speed=0.0&bearing=0.0&altitude=53.0&accuracy=0.0&batt=62.0 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 8.0.0; ONEPLUS A3003 Build/OPR1.170623.032)
Host: sailevent.net:5055
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 0
After restart
2018-12-28 13:45:12 INFO: [cf123dc3: 5055 < 82.29.218.147] HEX: 504f5354202f3f69643d3634353731342674696d657374616d703d31353436303034373039266c61743d35302e3738313837323032266c6f6e3d2d302e39343033333634372673706565643d302e302662656172696e673d302e3026616c7469747564653d35392e302661636375726163793d302e3026626174743d36302e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420382e302e303b204f4e45504c5553204133303033204275696c642f4f5052312e3137303632332e303332290d0a486f73743a207361696c6576656e742e6e65743a353035350d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2018-12-28 13:45:12 INFO: [cf123dc3: 5055 > 82.29.218.147] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2018-12-28 13:45:12 INFO: [cf123dc3] id: 645714, time: 2018-12-28 13:45:09, lat: 50.78187, lon: -0.94034, course: 0.0
After restart decoded
POST /?id=645714×tamp=1546004709&lat=50.78187202&lon=-0.94033647&speed=0.0&bearing=0.0&altitude=59.0&accuracy=0.0&batt=60.0 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 8.0.0; ONEPLUS A3003 Build/OPR1.170623.032)
Host: sailevent.net:5055
Connection: Keep-Alive
Accept-Encoding: gzip
Content-Length: 0
(I have the rest of the log with the restart if it would help but it is quite large.)
I can't see any significant difference so I'm not sure where to go from here. Is there some form of caching going on perhaps? Any ideas?
How do you add device programmatically? Make sure you use API and not just insert it directly into the database.
I was indeed inserting directly into the database and I'm sure that worked in 4.0 because I noticed this behaviour only after upgrading to 4.2. However reverting to 4.0 didn't fix it so I don't know what's going on there. Perhaps some kind of traccar wizardry.
But no matter, after much trial and error I now have adding and deleting devices via the API working and all is well again. If anyone wants to know how to do that in ASP.net/VB.net then I'm happy to share the technology.
So thanks for that but I do hope it doesn't mean that it is never safe to at least read the database directly. For example I need to get the latest positions of a set of devices.
Hi
I'm running Traccar Server 4.2 on my own Windows server, absolutely standard configuration except the database is MySQL 5.6 and I add devices programmatically. It has all been working fine except today I couldn't get my phone running Traccar Client (device id 645714) to log fixes.
Looking at the log I found that the server was reporting 645714 as an unknown device. I checked everything I could think of including the tc_devices table and everything looked good. In desperation I restarted the server and straightaway it recognised the device.
Log entries before and after the restart are:
Before restart
Before restart decoded
After restart
After restart decoded
(I have the rest of the log with the restart if it would help but it is quite large.)
I can't see any significant difference so I'm not sure where to go from here. Is there some form of caching going on perhaps? Any ideas?