Position messages attached to incorrect device when using a Azure Load balancer

Jabber2 months ago

Hi all,

I have a public facing Azure Load Balancer sitting in front of my Traccar server - I don't use the Traccar UI and only persist device messages to a database. My devices point to the load balancer's public DNS using their respective ports. The Traccar server is running v5.12. I do have multiple Traccar servers in the load balancer's backend pool, but have taken the rest offline while debugging this issue.

Since implementation of the load balancer in my test environment, I've started noticing a peculiar issue whereby at random times of the day, position messages are attached to the incorrect devices. This appears to only be prevalent when the port numbers differ per device type / manufacturer. i.e. DeviceA, port 5137, sends positional data and it randomly attaches to DeviceB, port 5027, which is reporting in at the same time.

If I remove the load balancer out of the equation by having the devices report directly to the Traccar server, the issue is resolved. The load balancer is purely listening on the respective ports, and then forwarding that TCP traffic to the available server in the backend pool on the same ports.

Digging through the forums I've come across the following tickets which appear to be somewhat similar to my experience and also mention using "decoder.ignoreSessionCache" which I don't find in the latest configuration documentation or the v5.12 code.

https://www.traccar.org/forums/topic/coordinates-mixing-in-traccar-41/
https://www.traccar.org/forums/topic/2-devices-swapping/#post-36802

Looking at the logs entries for each time this behavior occurs, it would appear the connection id is being shared across two device types (dmt, teltonika) at that point in time. The following is a masked extract.

2024-10-08 03:29:39  INFO: [T2aaea86d: teltonika < 100.0.0.4] 
2024-10-08 03:29:39  INFO: [T2aaea86d] id: <DMT_IMEI_1234>, time: 2024-10-08 03:29:37
2024-10-08 03:29:39  INFO: [T2aaea86d: teltonika > 100.0.0.4] 

2024-10-08 03:29:50  INFO: [T2aaea86d: teltonika < 100.0.0.4] 
2024-10-08 03:29:50  INFO: [T2aaea86d] id: <DMT_IMEI_1234>, time: 2024-10-08 03:29:47
2024-10-08 03:29:50  INFO: [T2aaea86d: teltonika > 100.0.0.4] 

2024-10-08 03:30:00  INFO: [T2aaea86d: teltonika < 100.0.0.4] 
2024-10-08 03:30:00  INFO: [T2aaea86d] id: <DMT_IMEI_1234>, time: 2024-10-08 03:29:57
2024-10-08 03:30:00  INFO: [T2aaea86d: teltonika > 100.0.0.4] 

Has anyone experienced a similar issue and/or know if there is any other setting that needs to be changed on the Traccar server to cater for a load balancer's connection handling?

Anton Tananaev2 months ago

Why is connection shared between devices? It should never happen for Teltonika.

Jabber2 months ago

Hi Anton,

I don't know why the connection appears to be shared across devices - the extract above is what the logs are showing. The load balancer doesn't have any special logic in it to manipulate connections.

Anton Tananaev2 months ago

To me it seems pretty clear that the load balancer combines those connections for some reason. Is there any evidence that it's not the case?