Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303937

Corrupted heap dumps due to missing retries for os::write()

    XMLWordPrintable

Details

    • 15
    • b14

    Backports

      Description

        After JDK-8237354, we noticed heap dumps could become corrupted.

        The root cause is in FileWriter::write_buf() in heapDumperCompression.cpp, for n = os::write(_fd, buf, (uint) size); n could be > 0 but smaller than size. In this case, there should be a loop to retry os::write() for the remaining bytes in buf. There was such a loop in DumpWriter::write_internal() before JDK-8237354.

        This problem is well documented in the man page for write(): https://man7.org/linux/man-pages/man2/write.2.html#RETURN_VALUE.

        In our case, we see the corruption frequently because we support dumping heap to a socket or pipe.

        Attachments

          Issue Links

            Activity

              People

                manc Man Cao
                manc Man Cao
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: