RFR: 8271003: hs_err improvement: handle CLASSPATH env setting longer than O_BUFLEN

Thomas Stüfe thomas.stuefe at gmail.com
Tue Aug 3 05:38:45 UTC 2021


On Tue, Aug 3, 2021 at 7:32 AM David Holmes <david.holmes at oracle.com> wrote:

> On 3/08/2021 2:38 pm, Thomas Stüfe wrote:
> >
> > Hi David,
> >      >
> >      > The problem is that the print_cr() functions are supposed to
> >     write the newline *with the same `write(2)` call*. That is not
> >     documented in do_vsnprintf(), but maybe we should do that since its
> >     an easy to miss a detail.
> >      >
> >      > Writing with one single `write(2)` call guarantees some atomicity
> >     when writing concurrently from several threads. If you write the
> >     newline separately, you risk line tear - the newline appearing away
> >     from its line.
> >
> >     Do we really rely on the write(2) call for atomicity? The
> defaultStream
> >     uses a lock and we could pass `add_cr` through to
> defaultStream::write
> >     so that the cr is added under the lock.
> >
> >
> > That would only work for the defaultStream, no? What about other streams?
>
> Do the other streams have atomicity in the first place? It's not an
> issue for stringStream as they aren't shared.
>
> David
>
>
We have fdStream and fileStream. Both are calling write(2) resp. fwrite(3)
directly. Yes, separate print invocations are not guaranteed to be atomic,
but today at least individual print_cr() calls are.

..Thomas

>
>


More information about the hotspot-runtime-dev mailing list