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

CDS should check for file truncation for all regions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 19
    • hotspot
    • b26

      CDS checks for file truncation with this in filemap.cpp:
        if (is_static()) {
          // just checking the last region is sufficient since the archive is written
          // in sequential order
          size_t len = os::lseek(fd, 0, SEEK_END);
          FileMapRegion* si = space_at(MetaspaceShared::last_valid_region);
          // The last space might be empty
          if (si->file_offset() > len || len - si->file_offset() < si->used()) {
            fail_continue("The shared archive file has been truncated.");
            return false;
          }
        }

      but when -XX:+UseSerialGC is used, the last_valid_region is empty so si->file_offset() == 0 and we didn't detect truncation. We should check all the regions instead. Also, this should be done for dynamic archive as well.

            ccheung Calvin Cheung (Inactive)
            ccheung Calvin Cheung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: