My service stops - JAVA Heap

bcavaco8 years ago

Hi Anton,

My server has been running for 1 month without problems.
Suddenly service stops! According to Wrapper Log an exception occurs: java.lang.OutOfMemoryError: Java heap space

Service didn't restart automatically so my server was down several hours.

  1. What situations can cause this? Some user trying to get a lot of data - reports?
  2. Can I do something to prevent this situations? How can I control this?
  3. Is any possibility to service automatically restart?

Regards
Details bellow.

My Specs:

Windows Server 2008 R2
Intel Xeon 2.4 GHZ
2 GB RAM
64 bit

Wrapper Log:

INFO|4640/0|Service traccar|16-11-25 20:21:03|Missing wrapper ping within timeout of 30000
WARNING|4640/0|Service traccar|16-11-25 20:21:23|ping between java application and wrapper timed out. if this this is due to server overload consider increasing wrapper.ping.timeout
INFO|wrapper|Service traccar|16-11-25 20:21:25|calling onStop
FINEST|4640/0|Service traccar|16-11-25 20:21:25|[qtp1475842502-39] WARN org.eclipse.jetty.servlet.ServletHandler - 
FINEST|4640/0|Service traccar|16-11-25 20:21:25|javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.OutOfMemoryError: Java heap space
INFO|wrapper|Service traccar|16-11-25 20:21:25|Win service stop - timeout: 30000
INFO|wrapper|Service traccar|16-11-25 20:21:25|Win service wrapper.control -> stopping application
INFO|wrapper|Service traccar|16-11-25 20:21:25|Win service stop - after shutdown
INFO|wrapper|Service traccar|16-11-25 20:21:25|Win service stop - before notify
INFO|wrapper|Service traccar|16-11-25 20:21:25|Win service terminated

Traccar Log:

2016-11-25 20:21:53  INFO: [2BA6E7F7] id: 868324028540529, time: 2016-11-25 20:21:37, lat: 38.88915, lon: -9.04063, speed: 0.0, course: 6.0
2016-11-25 20:21:53  INFO: [3A3F5246] id: 868324024947017, time: 2016-11-25 20:21:39, lat: 38.84634, lon: -9.07452, speed: 9.2, course: 274.2
2016-11-25 20:21:53  INFO: [3A3F5246] id: 868324024947017, time: 2016-11-25 20:21:41, lat: 38.84636, lon: -9.07461, speed: 6.5, course: 306.5
2016-11-25 20:21:57  INFO: Shutting down server...
2016-11-25 20:21:57  INFO: [3CB3E5FB] disconnected
2016-11-25 20:21:57  INFO: [1304C20C] disconnected
Anton Tananaev8 years ago

Looks like server ran out of memory. Possibly you need to allocate more memory for Traccar process. You can do it in the wrapper configuration file.

bcavaco8 years ago

On wrapper.conf.default I've settings bellow.
What parameter I've to change? wrapper.java.maxmemory?

Is there any problem if I increase to 1024 MB?

** Java Groovy Application Properties **

# Initial Java Heap Size (in MB)
# alternative for wrapper.java.additional.<n>=-Xms
#wrapper.java.initmemory=3

# % of total RAM
#wrapper.java.initmemory.relative=10

# Maximum Java Heap Size (in MB)
# alternative for wrapper.java.additional.<n>=-Xmx
#wrapper.java.maxmemory=64

# % of total RAM
#wrapper.java.maxmemory.relative=30
Anton Tananaev8 years ago

You should put "wrapper.java.maxmemory" parameter in the wrapper config file, not the default one.

bcavaco8 years ago

Thanks Anton!
So is just put wrapper.java.maxmemory=64 on conf file?? Or I've to increase value?

Regards

Now my conf file...

wrapper.java.command=java
wrapper.java.app.jar=tracker-server.jar
wrapper.app.parameter.1=./conf/traccar.xml
wrapper.java.additional.1=-Dfile.encoding=UTF-8
wrapper.logfile=logs/wrapper.log.YYYYMMDD
wrapper.logfile.rollmode=DATE
wrapper.ntservice.name=traccar
wrapper.ntservice.displayname=Traccar
wrapper.ntservice.description=Traccar
Anton Tananaev8 years ago

Yes, just make sure you replace 64 with a bigger number.

Edilon Carvalho 5 years ago

Onde fica o wrapper.conf no traccar 4.8? Aparentemente não tem
Como configuro?