BUG Report on API devices?userId= - Delete Device

Rogers Dwiputra7 years ago

Hi, i want to report a bug (maybe).

So this is the case :
Initial condition : my account has 4 devices

  1. I Add device to my account (So it's now 5 devices)
  2. i'm calling /api/devices?userId=3 it's return 5 devices
  3. then i delete the device (So it's now 4 devices left)
  4. i'm calling /api/devices?userId=3 it's still return 5 devices with one index is null

then i check the database,

  • on table devices, the device is deleted
  • but, on table user_device, it's still has record with deviceid that already deleted on devices table
    so maybe thats why /api/devices?userId=3 return 5 devices, i think theres is a bug when i delete the device it's only delete from devices table but not delete on the user_device table

sample json from /api/devices?userId=3

[null,{"id":2,"attributes":{},"groupId":0,"name":"Joyo","uniqueId":"564483","status":"unknown","lastUpdate":"2018-03-22T17:09:38.455+0000","positionId":1089,"geofenceIds":[],"phone":"","model":"","contact":"","category":null,"disabled":false},{"id":3,"attributes":{},"groupId":0,"name":"Rian","uniqueId":"382867","status":"offline","lastUpdate":"2018-03-21T09:36:03.000+0000","positionId":240,"geofenceIds":[],"phone":"","model":"","contact":"","category":null,"disabled":false},{"id":4,"attributes":{},"groupId":0,"name":"Nico","uniqueId":"939513","status":"unknown","lastUpdate":"2018-03-22T21:37:05.122+0000","positionId":1353,"geofenceIds":[],"phone":"","model":"","contact":"","category":null,"disabled":false},null,{"id":6,"attributes":{},"groupId":0,"name":"Willy","uniqueId":"486357","status":"unknown","lastUpdate":"2018-03-22T07:36:13.755+0000","positionId":505,"geofenceIds":[],"phone":"","model":"","contact":"","category":null,"disabled":false}]
Anton Tananaev7 years ago

Are you using MySQL with MyISAM engine by any chance? If yes, please read this:

https://www.traccar.org/mysql/

Rogers Dwiputra7 years ago

yes i use MyISAM i forgot about that because i re-install the server last night, thank you anton, i will change the database to InnoDB