traccar-web icon indicating copy to clipboard operation
traccar-web copied to clipboard

New devices won't populate on the server

Open WalrusHat opened this issue 7 years ago • 10 comments

I've got about 1000 devices on a VPS running Ubuntu and I cant get any new devices to register to the server. I'm using h02 devices and I've added resetDelay inside of the traccar.xml file but to no avail.

ulimit -a: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 514772 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 514772 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

Im not sure what is going on.

WalrusHat avatar Mar 04 '17 15:03 WalrusHat

You have limit for open file set to 1024:

open files (-n) 1024

Each active device will consume at least one socket, which is considered as open file. So you must increase open files limit, I recommend ten times higher value (10240).

vitalidze avatar Mar 04 '17 16:03 vitalidze

alright I was able to change that setting in /etc/security/limits.conf!

i added these lines

* soft nofile 10240
* hard nofile 10240

now ulimit -a prints out: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 514772 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 10240 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 514772 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

Do I have to now reset the devices I tried to install earlier? Because the ones I tried to add to the server previously are still not reporting any locations on the server.

WalrusHat avatar Mar 04 '17 17:03 WalrusHat

I tried removing and reinstalling the device from the software after doing this fix and I still am not receiving any updates from the device... Any other ideas?

netstat gives me this: 1 established) 1 Foreign 5 FIN_WAIT1 5 SYN_RECV 15 FIN_WAIT2 109 LISTEN 317 TIME_WAIT 485 ESTABLISHED

WalrusHat avatar Mar 04 '17 18:03 WalrusHat

Are you sure that these changes affected the user, who is running your traccar server? It may require restarting of your server or just the traccar service.

You can simulating connections with the scripts from original traccar project: https://github.com/tananaev/traccar/tree/master/tools This should give you some additional information on connection issues.

vitalidze avatar Mar 05 '17 05:03 vitalidze

i've restarted the traccar service a few times. I'll give the python script a shot but do you have any idea what I should be looking out for?

WalrusHat avatar Mar 05 '17 14:03 WalrusHat

Im not entirely sure how test-performance.py works... I ran the script on my raspberry pi but im not sure how to check it I command-c the script and it spit this out:

^CTraceback (most recent call last): File "test-performance.py", line 85, in loop.run_forever() File "/usr/lib/python3.4/asyncio/base_events.py", line 244, in run_forever self._run_once() File "/usr/lib/python3.4/asyncio/base_events.py", line 1049, in _run_once event_list = self._selector.select(timeout) File "/usr/lib/python3.4/selectors.py", line 424, in select fd_event_list = self._epoll.poll(timeout, max_ev) KeyboardInterrupt

WalrusHat avatar Mar 05 '17 15:03 WalrusHat

ran it again and got this

Task exception was never retrieved future: <Task finished coro=<create_connection() done, defined at /usr/lib/python3.4/asyncio/base_events.py:473> exception=gaierror(-2, 'Name or service not known')> Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/usr/lib/python3.4/asyncio/base_events.py", line 526, in create_connection infos = f1.result() File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result raise self._exception File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.4/socket.py", line 530, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known Task exception was never retrieved future: <Task finished coro=<create_connection() done, defined at /usr/lib/python3.4/asyncio/base_events.py:473> exception=gaierror(-2, 'Name or service not known')> Traceback (most recent call last): File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step result = next(coro) File "/usr/lib/python3.4/asyncio/base_events.py", line 526, in create_connection infos = f1.result() File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result raise self._exception File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.4/socket.py", line 530, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known Task exception was never retrieved future: <Task finished coro=<create_connection() done, defined at /usr/lib/python3.4/asyncio/base_events.py:473> exception=gaierror(-2, 'Name or service not known')>

WalrusHat avatar Mar 05 '17 15:03 WalrusHat

The idea is to simulate your device without invoking the real device. Then you can see whether server can accept connections by looking into server log (tracker-server.log) on the "server" side and into output of the script on the "client" side. To be honest I haven't used these scripts myself, I can just guess that they can help in simulation. Maybe it makes sense to ask similar question on the backend issue tracker: https://github.com/tananaev/traccar/issues

vitalidze avatar Mar 05 '17 15:03 vitalidze

@WalrusHat hi have you been able to solve the problem? if yes please provide info. thanks.

akmal1999 avatar Jun 02 '17 20:06 akmal1999

I have a similar problem, I had many tcp connections (around 1500) in ESTABLISHED state, you can found it with this command: netstat -ant | grep ESTABLISHED | wc -l

I changed two things: Firstly in the traccar.xml file in the conf folder I have inserted this line (before ):

<entry key='gps103.timeout'>60</entry>

according to Traccar's configuration file. You have to change "gps103" part according to your protocol that your GPS device supports. Also you have to change the 60 according to the configuration of your GPS device that send the coordinates to the server. I have the device to send the coordinates in an interval of 30'' so I have set the timeout 60''.

Secondly I have executed this echo 1200 > /proc/sys/net/ipv4/tcp_keepalive_time. This will set the timeout for the tcp connections to 1200'' from the default 7200''.

Doing the above changes I can see that the tcp connections have dropped to around 50 connections from around 1500 that I had previously had.

Good luck!

gsiotas avatar Jun 22 '17 22:06 gsiotas