Sixro
Sixro

Reputation: 429

Why Quartz Scheduler stops working on Heroku after x minutes?

I'm trying to create a similar application like the one mentioned here https://github.com/heroku/devcenter-java-quartz-rabbitmq suggested on Heroku by this article https://devcenter.heroku.com/articles/scheduled-jobs-custom-clock-processes-java-quartz-rabbitmq. The only difference is that at the moment I have a web app doing nothing ("Hello World") and a scheduler app printing the current time. Unfortunately, after 30 min that I'm not using the application, both web and scheduler stop working:

2020-02-09T15:20:17.911457+00:00 app[scheduler.1]: 15:20:17.911 [SpringContextShutdownHook] INFO  o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2020-02-09T15:20:18.151399+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
2020-02-09T15:20:18.151689+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO  o.s.s.quartz.SchedulerFactoryBean - Shutting down Quartz Scheduler
2020-02-09T15:20:18.151775+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutting down.
2020-02-09T15:20:18.151840+00:00 app[web.1]: 15:20:18.151 [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED paused.
2020-02-09T15:20:18.152244+00:00 app[web.1]: 15:20:18.152 [SpringContextShutdownHook] INFO  org.quartz.core.QuartzScheduler - Scheduler quartzScheduler_$_NON_CLUSTERED shutdown complete.
2020-02-09T15:20:18.152871+00:00 app[web.1]: 15:20:18.152 [SpringContextShutdownHook] INFO  o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2020-02-09T15:20:18.135436+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-02-09T15:20:18.247822+00:00 heroku[web.1]: Process exited with status 143
2020-02-09T15:20:18.123889+00:00 heroku[scheduler.1]: Process exited with status 143

The Procfile is pretty simple:

web: java $JAVA_OPTS -Dserver.port=$PORT -jar target/*.jar
scheduler: java $JAVA_OPTS -cp target/*.jar -Dloader.main=algotrading.app.scheduler.SchedulerApp org.springframework.boot.loader.PropertiesLauncher

Is there something I am missing in the example? Regards R

Upvotes: 0

Views: 458

Answers (1)

Sixro
Sixro

Reputation: 429

I opened a ticket as suggested by @codefinger and I received immediate support. The answer to my question is that when you are using a web dyno with free dynos, when it becomes idle (due to dyno sleeping) all other dynos will become idle too.

This is the expected behaviour. They will update the documentation as soos as they can.

Upvotes: 1

Related Questions