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

AsyncLogging will crash if rotate() fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 17
    • Fix Version/s: 17
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      17
    • Resolved In Build:
      b26
    • CPU:
      generic
    • OS:
      generic

      Description

      AsyncLogWriter::write() invokes LogFileOutput::write_blocking() directly.

      int LogFileOutput::write_blocking(const LogDecorations& decorations, const char* msg) {
        _rotation_semaphore.wait();
        int written = LogFileStreamOutput::write(decorations, msg);
        if (written > 0) {
          _current_size += written;

          if (should_rotate()) {
            rotate();
          }
        }
        _rotation_semaphore.signal();

        return written;
      }

      However, it doesn't put an exception case into consideraton.
      rotate() may fail before and leave _stream NULL.

      LogFileStreamOutput::write() will crash at flockfile(NULL)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              xliu Xin Liu
              Reporter:
              xliu Xin Liu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: