j_alc
j_alc

Reputation: 68

Play Framework 2.3.x scala - Application shutdown without exception

I have a play framework 2.3 application. When I deploy it my local machine in dev or production mode it works perfectly fine. However, when I deploy in a different server (Red Hat Enterprise Linux Server release 6.2, Santiago), after around 2 hours the application shuts down.
After profiling the application several times, I concluded that there aren't memory issues, deadlocks, etc. Everything is normal. I'm overriding the onStop method from GlobalSettings and logging a message like this:

 override def onStop(app: Application) {
    Logger.info("Application is shutting shutdown...ByeBye")
  }

and in the logs this is all what I see before the shutdown:

2015-05-27 00:36:54,515 - [INFO] - from application in **Thread-4** 
Application is shutting shutdown...ByeBye

For some reason, it always come from Thread-4. I have the log in DEBUG level and I don't see any exceptions or messages that could raise any red flag. It seems that something is killing the application or sending a signal to stop. I have not been able to determine the reason of this shutdown. There isn't anything being logged to /var/log/messages or any other log besides the one of my application. Any ideas that could lead me to understand why the application stops?

Some details of my application: It is very simple, it exposes a REST API. I'm building a binary file and all its dependencies using the 'dist' command. I start it this way:

/path/to/binary -Dhttp.port=5000  -J-Xmx32g -Dconfig.resource=application_prod.conf

Thank you.

Upvotes: 3

Views: 914

Answers (3)

Asher A
Asher A

Reputation: 349

Had a similar problem, apparently when running in debug mode ("run" command instead of "start" for production) it used to shutdown without exceptions after 4 seconds. Switching to prod. mode solved my problem.

Upvotes: 0

3ammari
3ammari

Reputation: 144

If you've been starting your application from the terminal via ssh ,after a while the ssh session might get terminated and the application process is attached to the session process , I went around this by executing the start command via nohup so the process will not be interactive anymore and will output the logs to the specified file instead of the terminal

Upvotes: 0

dr0i
dr0i

Reputation: 2470

There's an known issue providing java opts via -J parameter. Try JAVA_OPTS="-Xmx32g" ./activator instead. After doing this, check your running process list to approve if the java opts are really there.

Upvotes: 1

Related Questions