cloudfoundry / java-buildpack-auto-reconfiguration

Auto-reconfiguration functionality for the Java Buildpack
Apache License 2.0
219 stars 103 forks source link

Non-existing included file in Play configuration file throws IllegalArgumentException #40

Closed jonathan-yan closed 10 years ago

jonathan-yan commented 10 years ago

From Play documentation on configuration:

Include semantics: missing files

If an included file does not exist, the include statement should be silently ignored (as if the included file contained only an empty object).

Can the auto-reconfiguration reflect that behaviour instead of throwing 'java.lang.IllegalArgumentException: Unable to load configuration from ...'?

nebhale commented 10 years ago

Can you please elaborate a bit on the behavior that you're seeing? A small demo application (or a description of what we can do to the Play Test Application) that reproduces the problem would be good.

jonathan-yan commented 10 years ago

In the Play Test Application, if you add the line below in 'conf/application.conf' but do not add the corresponding file, then the application will still run without any errors from the command line but will break when you try to start it up in Cloud Foundry:

include "local.conf"

nebhale commented 10 years ago

@jonathan-yan Perfect. We'll prioritize an issue for this.

cgfrost commented 10 years ago

Hi @jonathan-yan

I'm taking a look at this issue and I can't recreate it by following the steps you have given. Is there anything else I need to do to the Play test application for it to fail, does it matter where in the file I add the include "local.conf" line? Also, could you attach the output from cf logs play-application --recent after the application has failed to start for you. Thank you.

jonathan-yan commented 10 years ago

@cgfrost I normally just put the include "local.conf" line at the end of the file but I don't think it really matters.

An extract of the output from cf logs play-application --recent is as follows:

2014-09-19T09:34:36.61+0100 [API] OUT Created app with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 2014-09-19T09:34:36.99+0100 [API] OUT Updated app with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 ({"route"=>"a8d855ef-4354-4fcc-ac5e-7268e157b5bb"}) 2014-09-19T09:34:58.60+0100 [DEA] OUT Got staging request for app with id 46f1e390-d86a-41a1-bdcf-a65add8c0db1 2014-09-19T09:34:59.68+0100 [API] OUT Updated app with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 ({"state"=>"STARTED"}) 2014-09-19T09:35:00.23+0100 [STG] OUT -----> Downloaded app package (37M) 2014-09-19T09:35:01.27+0100 [STG] OUT -----> Java Buildpack Version: v2.4 | https://github.com/cloudfoundry/java-buildpack.git#7cdcf1a 2014-09-19T09:35:04.35+0100 [STG] OUT -----> Downloading Open Jdk JRE 1.7.0_65 from https://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_65.tar.gz (2.9s) 2014-09-19T09:35:05.45+0100 [STG] OUT Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s) 2014-09-19T09:35:05.80+0100 [STG] OUT -----> Downloading Play Framework Auto Reconfiguration 1.4.0_RELEASE from https://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.4.0_RELEASE.jar (0.3s) 2014-09-19T09:35:05.84+0100 [STG] OUT -----> Downloading Spring Auto Reconfiguration 1.4.0_RELEASE from https://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.4.0_RELEASE.jar (found in cache) 2014-09-19T09:35:06.37+0100 [STG] ERR 2014-09-19T09:35:13.12+0100 [STG] OUT -----> Uploading droplet (70M) 2014-09-19T09:36:54.22+0100 [DEA] OUT Starting app instance (index 0) with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 2014-09-19T09:36:57.60+0100 [App/0] ERR Exception in thread "main" java.lang.IllegalArgumentException: Unable to load configuration from 'local.conf' 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.StandardApplicationConfiguration.loadFromInclude(StandardApplicationConfiguration.java:129) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.StandardApplicationConfiguration.loadConfiguration(StandardApplicationConfiguration.java:109) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.StandardApplicationConfiguration.loadConfiguration(StandardApplicationConfiguration.java:87) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.StandardApplicationConfiguration.getConfiguration(StandardApplicationConfiguration.java:50) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.StandardApplicationConfiguration.getDatabaseNames(StandardApplicationConfiguration.java:61) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.Configurer.configure(Configurer.java:41) 2014-09-19T09:36:57.60+0100 [App/0] ERR at org.cloudfoundry.reconfiguration.play.Bootstrap.main(Bootstrap.java:43) 2014-09-19T09:36:57.61+0100 [App/0] OUT 2014-09-19T09:36:57.64+0100 [DEA] ERR Instance (index 0) failed to start accepting connections 2014-09-19T09:36:57.66+0100 [API] OUT App instance exited with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 payload: {"cc_partition"=>"default", "droplet"=>"46f1e390-d86a-41a1-bdcf-a65add8c0db1", "version"=>"26e5ce31-1d22-47a9-be94-957c6719aea5", "instance"=>"a1fa3f9fe1434bb891822aa19ae04d03", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"app instance exited", "crash_timestamp"=>1411115817} 2014-09-19T09:37:01.07+0100 [DEA] OUT Removing crash for app with id 46f1e390-d86a-41a1-bdcf-a65add8c0db1 2014-09-19T09:37:01.07+0100 [DEA] OUT Stopping app instance (index 0) with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1 2014-09-19T09:37:01.07+0100 [DEA] OUT Stopped app instance (index 0) with guid 46f1e390-d86a-41a1-bdcf-a65add8c0db1

cgfrost commented 10 years ago

Thanks for the information. Will do some more digging.

cgfrost commented 10 years ago

I have a fix in the code. Once it is reviewed (and approved) it will be merged in and go out in the next release. This issue will remain open until the fix is reviewed.

nebhale commented 10 years ago

@jonathan-yan The change has been made available to any buildpack that goes to download.run.pivotal.io for dependencies (e.g. Pivotal Web Services). In order to see the update, you'll need to re-stage your application and look out for "Play Framework Auto Reconfiguration" and "Spring Auto Reconfiguration" version 1.5.0.RELEASE.

bhale-desktop master: cf restage play-application
Restaging app play-application in org bhale / space development as bhale@gopivotal.com...
OK
-----> Downloaded app package (37M)
-----> Downloaded app buildpack cache (79M)
Cloning into '/tmp/buildpacks/java-buildpack'...
-----> Java Buildpack Version: 3455de8 | https://github.com/cloudfoundry/java-buildpack.git#3455de8
-----> Downloading Open Jdk JRE 1.8.0_20 from https://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.8.0_20.tar.gz (found in cache)
       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.3s)
-----> Downloading Play Framework Auto Reconfiguration 1.5.0_RELEASE from https://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.5.0_RELEASE.jar (0.1s)
-----> Downloading Spring Auto Reconfiguration 1.5.0_RELEASE from https://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.5.0_RELEASE.jar (found in cache)
-----> Uploading droplet (77M)