On Fri, 25 Aug 2023 09:49:20 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> I want to add a log output similar to JDK-8301627 to Runtime.halt().
>> To avoid double logging of Runtime.exit(), add a flag to indicate whether 
>> logging was done, and fix it so that logging is done only once.
>> Could someone please review this fix?
>
> I think you may have missed the comment in the JBS issue. Logging means 
> running potentially arbitrary code, doing this at Runtime.halt time is 
> problematic. I thought the conclusion from the work on Runtime.exit was not 
> to log in Runtime.halt?

> @AlanBateman Sorry for missing your comment on JBS. I can't find any 
> discussion of the need for logs in Runtime.halt in JDK-8301627, so I'm not 
> sure if it was intentional that no logging output was added to Runtime.halt.
> However, if Runtime.halt is overlooked without discussion, I think it should 
> be added after considering the need.
> I think it's the same problem as Runtime.exit when it comes to executing 
> arbitrary code.
> Are there any issues specific to Runtime.halt?

The purpose of the halt method is to terminate immediately, it doesn't initiate 
the shutdown sequence. My recollection of the System.exit logging is that it 
was deliberate to not change the halt method. Changing halt to log means it 
would not terminate immediately. Also I think there were concerns with logging 
libraries that needed the shutdown hook to execute in order to fush/close logs. 
@RogerRiggs or @stuart-marks may be able to say more about this.

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

PR Comment: https://git.openjdk.org/jdk/pull/15426#issuecomment-1702371738

Reply via email to