RFR: JDK-8292351: tty should always live
David Holmes
dholmes at openjdk.org
Mon Aug 15 13:27:13 UTC 2022
On Mon, 15 Aug 2022 09:25:17 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> The default stream object tty is used in many places but its lifetime is limited. It gets born not-quite at the beginning of VM initialization and dies in DestroyVM. This leaves time windows before VM initialization and after VM cleanup where logging to tty crashes.
>
> This has been bugging me in the past, especially when wanting to use tty in code that runs very early (NMT preinit system, for example), and also causes problems for code that runs post-cleanup. Mostly this affects logging and error logging.
>
> tty should always be safe to write to, and that is trivial to do.
So effectively this just introduces an alternate tty device for pre-init and post-shutdown. But if the tty is not stdout then you are now forcing use of stdout in an environment where someone may have taken steps to ensure stdout is not in fact used. Is that real concern? I don't know. We jump through a number of hoops in terms of controlling VM output and it seems somewhat excessive to me, but I have to assume there were valid reasons for the level of complexity that it exists.
Need to think more about this ...
-------------
PR: https://git.openjdk.org/jdk/pull/9874
More information about the hotspot-dev
mailing list