On Wed, 19 Jan 2022 09:20:07 GMT, Xin Liu <x...@openjdk.org> wrote:

>>> This is in the signal handler. Is it safe to print message or do something 
>>> complex?
>> 
>> raw write to stdout should be fine I think.
>> 
>>>I would not print anything here, first because it is in the signal handler 
>>>and secondly I don't think it is needed. No real thread dump usages are 
>>>going to hit a VM that hasn't initialized yet IMO.
>> 
>> Might be nice for the user to know why his jcmd or kill -3 gets ignored 
>> though.
>
> because JVM_HANDLE_XXX_SIGNAL is installed in os::init_2(), it's safe to use 
> log. I added a log entry with the tag os+init.  -Xlog:os+init=info will print 
> out a message "ignore BREAK_SIGNAL in the initialization phase." I also 
> update the testing example in the description section.

Sorry for being difficult, but I would not do UL logging here. UL is 
heavyweight, and a shifting target too, because folks like to extend it with 
new capabilities. God knows what log_info really does (initialization, network 
traffic, accessing thread locals...) or will do in the future.

I'd keep it simple stupid and either just use write to fd=2 or fprintf(stderr). 
The former is safe to use in signal handling contexts, not sure about the 
latter. Otherwise maybe David is right and we skip the output altogether.

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

PR: https://git.openjdk.java.net/jdk/pull/7003

Reply via email to