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)
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)
- relates to
-
JDK-8229517 Support for optional asynchronous/buffered logging
- Resolved