When pushing a large Java-based application (including anything running on the JVM like Grails and Java Play), it is possible that the application takes longer to start.
A large or slow starting application can give an issue similar to the following when you run cf push:
Checking status of app '<app-name>'................ 0 of 1 instances running (1 starting) ... 0 of 1 instances running (1 starting) 0 of 1 instances running (1 down) 0 of 1 instances running (1 starting) 0 of 1 instances running (1 starting) Push unsuccessful.
When a large or slow starting application runs locally, it does not cause an issue while starting as the local application container waits for the application to start. However, when pushing it to the CloudFoundry (CF), the system restricts the time that the application has to start and begins listening for the requests.
There are two workarounds for this issue:
cf push
. This allows to increase the amount of time that CF waits for the application to start. Then, you can increase the value up to 180 seconds on Pivotal web Services (PWS).If the application is taking an unexpectedly long time to start, investigate what is happening at start up. This Java Web Applications Start Slow or are Failing discusses a common case for why Java/JVM based applications start slowly.
Another common cause of slow start of an application is the failed connections to the external resources, like databases. In some cases, when a connection cannot be established, the connection attempt just hangs. It will eventually timeout slowly. Also, there can be a connection pool that is making multiple connections at the start up. This can cause the application to fail to start within the time given by the PWS.