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

jfrRepository.cpp write_emergency_file doesn't handle errors from os::read_at

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • tbd
    • 12, 13
    • hotspot
    • None
    • jfr

              jlong bytes_read = 0;
              jlong bytes_written = 0;
              while (bytes_read < current_filesize) {
                bytes_read += (jlong)os::read_at(current_fd, file_copy_block, size_of_file_copy_block, bytes_read);
                assert(bytes_read - bytes_written <= (jlong)size_of_file_copy_block, "invariant");
                bytes_written += (jlong)os::write(emergency_fd, file_copy_block, bytes_read - bytes_written);
                assert(bytes_read == bytes_written, "invariant");
              }

      read_at() will return -1 on error. It is currently defined to return a size_t, which is unsigned and incorrect - meaning on error bytes_written would appear huge. Under JDK-8214816 os::read_at is being changed to return the correct ssize_t.

            Unassigned Unassigned
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: