Can't get fatal error log for my Java application

巧了我就是萌 提交于 2020-01-16 18:20:24

问题


Help! I have a Java headless iterative calculation-intensive servlet running 24/7 on Unix, that a few builds ago has started crashing after about a day or so, and I can't for the LIFE of me get a crash log / dump / indicator of any kind as to why. No manner of JVM arguments, shut down hooks, etc have helped me to get any sort of log as to what might be happening. Crash is not reproducible on-command, or predictable. Happens roughly every 20-30 hours.

OS: Amazon Linux AMI

Hardware: AWS EC2 T3.medium instance (4GB mem)

JVM arguments are below

STEPS TRIED SO FAR:

  • Tried -XX:ErrorFile JVM arg with different paths and file names, to no avail (no error file created, tried looking everywhere). Definitely no existing file that would block another one from being written.

  • Tried -XX:+HeapDumpOnOutOfMemoryError JVM arg (no dump file created, tried looking everywhere).

  • Opened permissions on the application home directory to 777 so that the logs can write.

  • Opened permissions on the Java home directory to 777 as well, just in case (Java directory discovered by using 'which java' command): /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.45.amzn1.x86_64

  • Checked GC logs - no Full GCs around the crash, however the GC logs have always been pretty active even while stable, with YoungGen minor reclamation every 10 seconds or so. GC logs leading up to the crash show no deviation in pattern from GC logs 1 hour or 12 hours prior.

  • Checked app logs - it always crashes around a flurry of OKHTTP requests, but there's also a TON of other async processing stuff happening at the same time, so it's hard to tell if its HTTP/network-related or not (could be)

  • Added a shutdown hook in the app code to dump all stack traces to the app log upon exit, but nothing is ever printed during the crash (yet a simple manual 'kill PID' command proves the shutdown hook works)

  • Hard to tell INSTANTANEOUS memory usage during the crash, but intermittent logs showing memory stats from a second or two before it shows an average usage of around 1.5GB (on a 2.5GB max JVM, sometimes 3GB)

  • Tried several different Unix machines, with varying amounts of RAM (same issue)

  • Tried fooling with JVM arg memory limit (-Xmx) to no avail

I am at my wits' end just trying to get a crash log to figure out what might be happening. Any other suggestions on what to try next?

JVM arguments (within start.ksh file in app home directory, executed as su):

sudo -u arbadm java -cp ${CLASSPATH} -d64 -Xms2048m -Xmx2560m -Xloggc:../log/gc_date +%F.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCCause -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:ErrorFile=./hs_err_file_%p.log -Xss4096k -Dsun.java2d.d3d=false com.package.Main &

来源:https://stackoverflow.com/questions/57651010/cant-get-fatal-error-log-for-my-java-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!