Server freeze after some time (requires restart to work again)

Alex3 years ago

Hi,
after few hours traccar server freezes, no response to devices and no response to web application, even if i hit api using postman still no response,
i have to kill and restart every time when it freezes
these are the logs.

2021-07-01 16:37:56  INFO: [4624c63a: teltonika > 94.57.216.88] HEX: 00000005
2021-07-01 16:37:56  INFO: [d90d929e: galileo < 94.57.216.88] HEX: 011c002023b7dd60300cba13860110b94f0333f4008302350641023450a3345e566
2021-07-01 16:37:56  INFO: [d90d929e: galileo > 94.57.216.88] HEX: 025e56
2021-07-01 16:37:59  INFO: [fd66fa93: galileo < 94.57.216.88] HEX: 012b002025b7dd60300c255d7f018c0a4e033387031002350741506e460100508c6e9000000000d500e2b925371c344ee
2021-07-01 16:37:59  INFO: [fd66fa93: galileo > 94.57.216.88] HEX: 02344e
2021-07-01 16:38:18  WARN: /api/socket - NullPointerException
2021-07-01 16:39:19  WARN: /api/socket - NullPointerException
2021-07-01 16:40:20  WARN: /api/socket - NullPointerException
2021-07-01 16:41:21  WARN: /api/socket - NullPointerException
2021-07-01 16:42:22  WARN: /api/socket - NullPointerException
2021-07-01 16:43:23  WARN: /api/socket - NullPointerException
2021-07-01 16:44:24  WARN: /api/socket - NullPointerException
2021-07-01 16:45:25  WARN: /api/socket - NullPointerException
2021-07-01 16:46:26  WARN: /api/socket - NullPointerException
2021-07-01 16:47:27  WARN: /api/socket - NullPointerException

any suggestions what's causing this, or how can i over come this issue
my server is with 16GB ram and 500GB hard with core i7.

Anton Tananaev3 years ago

Have you checked memory and CPU usage for the process?

Alex3 years ago

Before getting freeze it use 7-8% ram and 8-10% cpu
After freeze the ram usage remains almost same and cpu usage drop to 1-2 percent

On freeze Over all server have 60%-70% free memory and cpu also free
OS working fine other applications also
No issue in using any other application even when traccar is freeze

Anton Tananaev3 years ago

I guess you'll need to check jstack thread dump for the process to see what's happening.

Alex3 years ago

i fount this in thread dump

Found one Java-level deadlock:
=============================
"nioEventLoopGroup-3-1":
  waiting for ownable synchronizer 0x000000070734bcb8, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
  which is held by "nioEventLoopGroup-3-2"
"nioEventLoopGroup-3-2":
  waiting for ownable synchronizer 0x000000070ca03b38, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
  which is held by "qtp1003928100-534"
"qtp1003928100-534":
  waiting for ownable synchronizer 0x000000070734bcb8, (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
  which is held by "nioEventLoopGroup-3-2"

any suggestions how to avoid this, or what's causing this?

Anton Tananaev3 years ago

Are there full stack traces for those threads?

Alex3 years ago

here is the complete thread dump file link https://files.fm/u/hw2fuuycz

Anton Tananaev3 years ago

Very interesting. I see this lock:

at org.traccar.api.resource.PermissionsResource.addMultipleProperty(PermissionsResource.java:195)

Did you forget to tell us that you are not using official version of Traccar?

Alex3 years ago

sorry I forget to mention.
this function is to link multiple devices to user in single call, same as link single device to user.
I'm unable to understand thread dump file, can you just specify what's cause this deadlock or which part of code/ dump file line, that will be really helpful.

thanks.

hvendrame2 years ago

I`m get this erro too.

When I run jstack, i get the message:

jstack -l 952 
952: Operation not permitted

I`m using Ubuntu 20.04 with 4 vcpu and 16 GB memory, this machine run only webserver/web the database run in other vm.
Around 650 devices.
Traccar 5.0 official.
Web old version (official)

The server freeze and I only can access if reboot.

Anton Tananaev2 years ago

Are you running jstack as a root user?

hvendrame2 years ago

No, now I run with root and get this:

https://pastebin.com/SBSBS8ki

Anton Tananaev2 years ago

I don't see any locked threads. What makes you think Traccar freezes?

hvendrame2 years ago

I don't get log on system...
When I see the syslog doesn`t have something.

When I check traccar log, I see this line:

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^>

I try to change SSD to HDD on VM, but, not work too.

hvendrame2 years ago

Anton, can you help me?

I tried change ubuntu 20.04 to Debian 10.
But it not work too.

What I see the memory only use max 2g but my ExecStart is:

ExecStart=java -Djdk.tls.client.protocols=TLSv1.2 -Xms3G -Xmx6G -jar tracker-server.jar conf/traccar.xml

Java version

openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb10u1, mixed mode, sharing)