While observing a loop while using -verbose option it would seem that a destructor call
in the iterator constructor causes wait_until_no_readers to go into an infinite loop.
On analysis the issue seems to be in file src/hotspot/share/logging/logOutputList.cpp
The issue is due to invoking of destructor in iterator constructor due to creation of
an object in the following code:
Iterator iterator(LogLevelType level = LogLevel::Last) {
increase_readers();
return Iterator(this, _level_start[level]);
}
Again, when the object is destroyed, the destructor is called again.
Due to this the _active_readers count becomes negative and wait_until_no_readers
goes into infinite loop.
void LogOutputList::wait_until_no_readers() const {
OrderAccess::storeload();
while (_active_readers != 0) {
// Busy wait
}
}