eclipse-openj9 / openj9-utils

Other
16 stars 29 forks source link

Catch json parse exceptions and fail gracefully #59

Closed mpirvu closed 3 years ago

mpirvu commented 3 years ago

Currently, if there is a syntax error in the command file, the json library will throw an exception and the JVM will generate a core dump.

terminate called after throwing an instance of 'nlohmann::detail::parse_error'
  what():  [json.exception.parse_error.101] parse error at line 7, column 3: syntax error while parsing object key - unexpected '}'; expected string literal
JVMDUMP039I Processing dump event "abort", detail "" at 2021/03/22 18:37:19 - please wait.
JVMDUMP032I JVM requested System dump using '/home/mpirvu/CANOSP/Test/core.20210322.183719.14378.0001.dmp' in response to an event
JVMPORT030W /proc/sys/kernel/core_pattern setting "|/lib/systemd/systemd-coredump %P %u %g %s %t 9223372036854775808 %e" specifies that the core dump is to be piped to an external program.  Attempting to rename either core or core.14401.

It may be nicer to catch such exceptions, print a message and exit gracefully.