cantaloupe-project / cantaloupe

High-performance dynamic image server in Java
https://cantaloupe-project.github.io/
Other
266 stars 107 forks source link

Health-check failures for configuration parsing errors? #297

Open acdha opened 5 years ago

acdha commented 5 years ago

I deployed a container before noticing that the config file parser doesn't support inline comments (e.g. cache.server.derivative.ttl_seconds = 2592000 # 30 days). The health-check endpoint was returning success so it took a little longer to notice until I hit an image URL and noticed the 500 error. It'd be neat if there was a way to either have the health-check fail for broken config files.

adolski commented 5 years ago

Hi @acdha,

I can't reproduce (in 4.1 and 4.0) cache.server.derivative.ttl_seconds causing HTTP 500 errors when set with a trailing comment.


Setting that aside, a line like:

some.key = 300 # comment

is structurally valid for the properties format, so it would pass a basic check. For a more comprehensive check, the data type of each key and its legal ranges/lengths/values/etc. would need to be accounted for.

acdha commented 5 years ago

Yes, I realize that it requires validation at different stages. The main problem here is that it'll prevent any use of the service but the service doesn't exit — if it simply crashed the first time something failed to parse the config value that'd make the problem more obvious.

I'll see if I can get a simpler testcase – the example above was copied from the CloudWatch logs but I can't trivially reproduce it locally.