Java Crash in GCTaskThread

Solution Verified - Updated

Environment

  • Oracle JDK
  • OpenJDK

Issue

  • JVM crashes with the current thread GCTaskThread:
Current thread (0x000000004013c5c0):  GCTaskThread [id=22820]

Resolution

  • A workaround may be to try a different collector (e.g. throughput, G1) or improve garbage collection performance.
  • Upgrade to the latest OpenJDK, OracleJDK.
  • If OracleJDK, open a support case with Oracle support to rigorously troubleshoot this.

Root Cause

Known causes:

Diagnostic Steps

  • Analyze the fatal error log:
    • What collector is doing concurrent marking when the crash happens?
    • Check the size of the objects in the "from" and "to" spaces in the fatal error log at the time of the crash. Normally one survivor space is always 0, but with this issue both survivor spaces are populated. During a young collection, first the live objects in the eden space are copied to the 2nd survivor space, then the live objects from the 1st survivor space are copied to the 2nd survivor space, resulting in the 1st survivor space being empty. Because the crash happens when live objects from the eden space are copied to the 2nd survivor space, both the "from" (1st survivor space) and "to" (2nd survivor space) contain objects.
    • Enable garbage collection logging and analyze performance:
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.