RFR: 8267952: async logging supports to dynamically change tags and decorators
David Holmes
dholmes at openjdk.java.net
Wed Jun 9 04:44:12 UTC 2021
On Tue, 8 Jun 2021 03:10:56 GMT, Xin Liu <xliu at openjdk.org> wrote:
> Support dynamic reconfiguration for async logging. 2 unittests are provided.
> The regression test discovers a race condition in LogTagSet::log() even with
> synchronous logging. It's not MT-safe if context switch happens between the
> creation of LogDecorations and LogOutputList::Iterator. fixed.
src/hotspot/share/logging/logConfiguration.cpp line 268:
> 266: //
> 267: // LogDecorator is a set of decorators represented in a uint. sizeof(uint) is not greater than a machine word,
> 268: // so store of it is atomic on the mainstream processors. I.e. readers see either its older value or new value.
This is not necessarily true - the field also has to have correct alignment to ensure atomic accesses. The convention we are adopting is that all racily accessed fields like _decorators should be declared volatile, and accessed using Atomic::load and Atomic::store.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4408
More information about the hotspot-runtime-dev
mailing list