Received Error if multicast is configured in traccar.xml for Horizontal Scaling

psjphoon2 years ago
2023-07-27 15:37:32  INFO: [T18d4e008] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - 
NullPointerException (MulticastBroadcastService:133 < *:87 < ConnectionManager:289 < *:275 < BaseProtocolDecoder:194 < ...)
2023-07-27 15:37:32  INFO: [T18d4e008] disconnected
2023-07-27 15:37:33  INFO: [T18d4e008] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - 
NullPointerException (MulticastBroadcastService:133 < *:87 < ConnectionManager:289 < *:275 < *:190 < MainEventHandler:168 < ...)

Hi, we are getting this error after added below in traccar.xml when we received messages from Teltonika devices (FMC001 and FMC003).

<entry key='broadcast.interface'>eth0</entry>
<entry key='broadcast.address'>10.0.1.255</entry>
<entry key='broadcast.port'>7007</entry>

However, it has no issue if we are using Traccar Client mobile app.

We are hosting traccar server version 5.8 in Azure VM.

Any idea what this error is about?

Thank you.

Anton Tananaev2 years ago

Your address doesn't seem like a valid multicast address.

Harshana Srimal2 years ago

I have the save issue.

here is the ifconfig output

ens5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
inet 172.31.1.164  netmask 255.255.255.0  broadcast 172.31.1.255

here is the config I used

    <entry key='broadcast.interface'>ens5</entry>
    <entry key='broadcast.address'>172.31.1.255</entry>
    <entry key='broadcast.port'>7001</entry>

Here is the error:

2023-08-25 08:46:02  INFO: [Tba974a68] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - NullPointerException (MulticastBroadcastService:133 < *:87 < ConnectionManager:289 < *:275 < BaseProtocolDecoder:194 < ...)
2023-08-25 08:46:02  INFO: [Tba974a68] disconnected
2023-08-25 08:46:02  INFO: [Tda0070b0] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - NullPointerException (MulticastBroadcastService:133 < *:87 < ConnectionManager:289 < *:275 < BaseProtocolDecoder:194 < ...)
2023-08-25 08:46:02  INFO: [Tda0070b0] disconnected
2023-08-25 08:46:03  INFO: [Tba974a68] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - NullPointerException (MulticastBroadcastService:133 < *:102 < ConnectionManager:320 < NotificatorWeb:57 < ...)
2023-08-25 08:46:03  INFO: [Tda0070b0] error - Cannot invoke "java.net.DatagramSocket.send(java.net.DatagramPacket)" because "this.publisherSocket" is null - NullPointerException (MulticastBroadcastService:133 < *:102 < ConnectionManager:320 < NotificatorWeb:57 < ...)
psjphoon2 years ago

Are you hosting in Azure or any other Cloud instances?

Harshana Srimal2 years ago

I'm using AWS EC2

Harshana Srimal2 years ago

I think AWS doesn't support Multicast.

Anton Tananaev2 years ago

What you're using is not even a valid multicast address.

Harshana Srimal2 years ago

Ifconfig says broadcast 172.31.1.255 on both servers

is that wrong

(Can you please lift the rate limit from my other account? I can't reply using that account)

Anton Tananaev2 years ago

That's a broadcast address, not multicast. I think you need to take your time and do a bit of reading before asking more questions.

Harshana Srimal2 years ago

My mistake. I thought both are similar. anyhow if I use Horizontal scaling, How can we use database in local?

we have to select one server to host the database.

I feel it against the recommended configuration.

can you explain the architect that we should use with traccar please.

Anton Tananaev2 years ago

With horizontal scaling obviously you won't be able to use a local database. Instead you would use a database cluster.

Harshana Srimal2 years ago

If then will it slow down the system?

Its still using high CPU but, I see the accuracy after changing the remote DB to local. Thank you so much for your support.

Anton Tananaev2 years ago

Of course it might make some things a bit slower than local setup, but it will allow you to scale to a really large number of devices.

Harshana Srimal2 years ago

Thanks for the details. I will take a look regarding multicasting. anyhow I read an article regarding AWS and it said that AWS doesn't support multicasting and they only support unicasting.