RFR: JDK-8292351: tty should always live [v4]

David Holmes dholmes at openjdk.org
Fri Aug 19 01:20:33 UTC 2022


On Wed, 17 Aug 2022 09:30:48 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.
>
> Thomas Stuefe has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change comment

Hi Thomas,

I think for pre-init we would look at adding an env var (which would require a CSR request) when we actually have some logging we want to add. This PR could simply do the enabling for tty to be usable at that time ie set to stdout (as the default VM output destination).

Your suggestion for post-exit seems reasonable, though we may also have to consider the flag that requests VM output get logged to a file (which we probably can't do). I think it reasonable that error and warning output go to stdout/stderr in post-exit. If other more general logging needed to be added for post-exit then that would be evaluated at the time.

Thanks.

-------------

PR: https://git.openjdk.org/jdk/pull/9874


More information about the hotspot-dev mailing list