cloudfoundry / java-buildpack-memory-calculator

Cloud Foundry JVM Memory Calculator
Apache License 2.0
645 stars 70 forks source link

Log messages should end with newlines #8

Closed giner closed 7 years ago

giner commented 7 years ago

Log lines do not have newlines and this results in one of the following:

glyn commented 7 years ago

@giner Please could you provide an example?

giner commented 7 years ago

Sure. Please check bellow.

Here is command from manifest

"echo START_MESSAGE >&2; CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-3.3.0_RELEASE -totMemory=$MEMORY_LIMIT -stackThreads=300 -loadedClasses=17612 -poolType=metaspace) &&  JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS=\"-Djava.io.tmpdir=$TMPDIR $CALCULATED_MEMORY -agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvmkill-1.4.0_RELEASE=printHeapHistogram=1 -Djavax.net.ssl.trustStore=$PWD/.java-buildpack/container_certificate_trust_store/truststore.jks -Djavax.net.ssl.trustStorePassword=java-buildpack-trust-store-password -Djava.endorsed.dirs=$PWD/.java-buildpack/tomcat/endorsed -Daccess.logging.enabled=false -Dhttp.port=$PORT\" exec $PWD/.java-buildpack/tomcat/bin/catalina.sh run; echo END_MESSAGE >&2; sleep 10"

Logs

...
2017-03-15T17:42:15.36+0900 [App/0]      ERR START_MESSAGE
2017-03-15T17:42:15.36+0900 [App/0]      ERR Cannot calculate memory: insufficient memory remaining for heap. Memory limit 512M < allocated memory 696479K (-XX:ReservedCodeCacheSize=240M, -XX:MaxDirectMemorySize=10M, -XX:MaxMetaspaceSize=113427K, -XX:CompressedClassSpaceSize=19851K, -Xss1M * 300 threads)END_MESSAGE
2017-03-15T17:42:25.35+0900 [App/0]      OUT 
2017-03-15T17:42:25.37+0900 [DEA/0]      ERR Instance (index 0) failed to start accepting connections
2017-03-15T17:42:25.38+0900 [API/0]      OUT App instance exited with guid 3644d825-6cf4-43eb-ab27-dff8959bf543 payload: {"cc_partition"=>"default", "droplet"=>"3644d825-6cf4-43eb-ab27-dff8959bf543", "version"=>"57ec31d2-2eae-4e64-96cc-62ea23283cf6", "instance"=>"021c196ba1d1443bb6708a9146419779", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1489567345}
2017-03-15T17:42:25.38+0900 [API/0]      OUT App instance exited with guid 3644d825-6cf4-43eb-ab27-dff8959bf543 payload: {"cc_partition"=>"default", "droplet"=>"3644d825-6cf4-43eb-ab27-dff8959bf543", "version"=>"57ec31d2-2eae-4e64-96cc-62ea23283cf6", "instance"=>"021c196ba1d1443bb6708a9146419779", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1489567345}
2017-03-15T17:42:33.68+0900 [DEA/0]      OUT Removing crash for app with id 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:42:33.68+0900 [DEA/0]      OUT Stopping app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:42:33.68+0900 [DEA/0]      OUT Stopped app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:43:07.02+0900 [DEA/0]      OUT Starting app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:43:09.73+0900 [App/0]      ERR START_MESSAGE
2017-03-15T17:43:09.73+0900 [App/0]      ERR Cannot calculate memory: insufficient memory remaining for heap. Memory limit 512M < allocated memory 696479K (-XX:ReservedCodeCacheSize=240M, -XX:MaxDirectMemorySize=10M, -XX:MaxMetaspaceSize=113427K, -XX:CompressedClassSpaceSize=19851K, -Xss1M * 300 threads)END_MESSAGE
2017-03-15T17:43:19.72+0900 [App/0]      OUT 
2017-03-15T17:43:19.75+0900 [DEA/0]      ERR Instance (index 0) failed to start accepting connections
2017-03-15T17:43:19.75+0900 [API/0]      OUT App instance exited with guid 3644d825-6cf4-43eb-ab27-dff8959bf543 payload: {"cc_partition"=>"default", "droplet"=>"3644d825-6cf4-43eb-ab27-dff8959bf543", "version"=>"57ec31d2-2eae-4e64-96cc-62ea23283cf6", "instance"=>"45c872b37677498994a9375ec0bb634a", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1489567399}
2017-03-15T17:43:19.75+0900 [API/0]      OUT App instance exited with guid 3644d825-6cf4-43eb-ab27-dff8959bf543 payload: {"cc_partition"=>"default", "droplet"=>"3644d825-6cf4-43eb-ab27-dff8959bf543", "version"=>"57ec31d2-2eae-4e64-96cc-62ea23283cf6", "instance"=>"45c872b37677498994a9375ec0bb634a", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1489567399}
2017-03-15T17:43:23.69+0900 [DEA/0]      OUT Removing crash for app with id 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:43:23.69+0900 [DEA/0]      OUT Stopping app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:43:23.69+0900 [DEA/0]      OUT Stopped app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:44:07.04+0900 [DEA/0]      OUT Starting app instance (index 0) with guid 3644d825-6cf4-43eb-ab27-dff8959bf543
2017-03-15T17:44:09.78+0900 [App/0]      ERR START_MESSAGE
2017-03-15T17:44:09.78+0900 [App/0]      ERR Cannot calculate memory: insufficient memory remaining for heap. Memory limit 512M < allocated memory 696479K (-XX:ReservedCodeCacheSize=240M, -XX:MaxDirectMemorySize=10M, -XX:MaxMetaspaceSize=113427K, -XX:CompressedClassSpaceSize=19851K, -Xss1M * 300 threads)END_MESSAGE
...
glyn commented 7 years ago

Thanks @giner. Fixed by f92797f31e9291.

@nebhale please could you include this fix in a release.