Redrew Geofence, Geofences Stopped Working, Please Help!

kawstraining2 years ago

Used & loved wonderful Traccar for years no problem. Today I got the bad idea to redraw a geofence, now

  • that redrawn geofence does not show up in Events or when I make an api call for devices, the geofenceIds array is always empty.

  • I tried making a new geofences and those do not show up in events or in api calls either.

  • The geofences are linked to devices correctly. I unchecked and rechecked all boxes just to make sure. I tried deleting notifications of geofence exits and making a new notification of geofence exits.

  • Initially the redrawn geofence and a new geofence were overlapping.

Nothing works anymore, please please help!

1 Are you not allowed to redraw a geofence?
2 Are geofences not allowed to be overlapping?
3 Am I missing a step? Any ideas why no more geofence exits are reported and the device id geofenceIds array is always empty?

Anton Tananaev2 years ago

Geofences are checked when location is received. So if your device hasn't sent any new data, it's expected that they won't be updated. But if you received new data and still nothing, you're probably missing something.

Have you tried restarting Traccar? Maybe some caching issue?

kawstraining2 years ago

Many devices are sending new data. I tried deleting the original geofence where the new geofence was drawn and I am waiting for a device to enter the geofence. I will try restarting, I have not restarted for many many years. Looks like overlapping geofences are allowed, or new geofences in the location of the old geofence are allowed, because you did not say no. Heartbroken because I love Traccar.

kawstraining2 years ago

Solution: I needed to redraw the geofence with the "Polygon" tool not "Polyline" tool.

kawstraining2 years ago

incidentally I got this error when I rebooted, don't know what it means:

WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/opt/traccar/lib/guice-4.2.2.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)

Also I was wondering if the DB automatically purges data after what period of time? I had the server running for many years without a problem.

Anton Tananaev2 years ago

You can safely ignore that warning.

Also I was wondering if the DB automatically purges data after what period of time?

It doesn't, but you should consider this:

https://www.traccar.org/clear-history/

kawstraining2 years ago

thanks, but I am still using the H2 database, in production with 10 devices, it has been years, is there a purge script/clear history script needed for the embedded H2 database? I may go to 30 devices this year, and then max of 300 within the next year few years.

Anton Tananaev2 years ago

Don't have a ready script, but it should be possible to do something similar.

But you should really migrate off of H2 before you lose all of your data.

kawstraining2 years ago

I messed with the Geofence and it broke, mysql migration carries some level of risk and downtime, off the bat I can imagine problems with mysql schema and traccar access to mysql and permissions.

it would be easier to somehow delete data older than 3 months on H2, if you ever get time to please provide that script.

Anton Tananaev2 years ago

It's not about the amount of data. It's about the fact that H2 is not very reliable. Sooner or later you get a corrupted database and you lose everything. You're basically taking a risk every day by not migrating. Migration is a one off risk. Your choice of course.

kawstraining2 years ago

I looked at the Docker image Readme and it says H2 is used.

Could you please release a docker image of Traccar with MySQL which runs on Ubuntu, that way it is trustworthy/without malware and the settings/schema are sure to be set by you?

Anton Tananaev2 years ago

You should just run MySQL as a separate container.