RFR: 8145934: Make ttyLocker equivalent for Unified Logging framework
Thomas Stüfe
thomas.stuefe at gmail.com
Thu Feb 11 08:27:13 UTC 2016
Hi Marcus,
thank you for implementing this!
I am happy that you implement this with a temporary buffer rather than
implementing a lock.
I did not yet look closely at all changes, this is quite a large change.
But I have some questions about the memory you use:
You use either resource area or NMT-tracked C heap. In both cases this is
quite "high level memory" in the sense that it uses a number of components.
These components then cannot use logging (or at least the LogMessage)
without introducing circular references. Worse, this may often work and
only crash if the LogMessage::grow() function grows the buffer, so it is
difficult to test.
Would it not be better to use plain low-level raw malloc in this case?
Or, alternativly, factor memory allocation out into an own interface to be
used as template parameter, so that most people get a reasonable default:
LogMessage myMessage;
..
but low level components like NMT, for example, could do:
LogMessage<MyRawMallocator> myMessageUsingRawMalloc;
?
A second concern with using ResourceArea: One has to be careful with
handing down LogMessage objects to subroutines, to fill the LogMessage
object, and further down the callstack happens another ResourceMark
destroying the LogMessage buffer. Could that be a problem, and if yes,
could we have an assert for this case?
Kind Regards, Thomas
On Wed, Feb 10, 2016 at 2:49 PM, Marcus Larsson <marcus.larsson at oracle.com>
wrote:
> Hi,
>
> Please review the following patch adding support for non-interleavable
> multi-line log messages in UL.
>
> Summary:
> This patch adds a LogMessage class that represents a multiline log
> message, buffering lines that belong to the same message. The class has a
> similar interface to the Log class, with printf-like methods for each log
> level. These methods will append the log message with additional lines.
> Once all filled in, the log message should be sent to the the appropriate
> log(s) using Log<>::write(). All lines in the LogMessage are written in a
> way that prevents interleaving by other messages. Lines are printed in the
> same order they were added to the message (regardless of level). Apart from
> the level, decorators will be identical for lines in the same LogMessage,
> and all lines will be decorated.
>
> Webrev:
> http://cr.openjdk.java.net/~mlarsson/8145934/webrev.00/
>
> Issue:
> https://bugs.openjdk.java.net/browse/JDK-8145934
>
> Testing:
> Included tests through JPRT
>
> Thanks,
> Marcus
>
More information about the hotspot-dev
mailing list