RFR: 8332112: Update nsk.share.Log to don't be Finalizable

Leonid Mesnik lmesnik at openjdk.org
Mon May 13 15:56:17 UTC 2024


On Sun, 12 May 2024 21:34:41 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:

> The nsk.share.Log doing some cleanup and reporting errors in the cleanup method. This method is supposed to be executed by finalizer originally. However, now it is called only during shutdown hook. 
> The cleanup using Cleaner doesn't work. See https://bugs.openjdk.org/browse/JDK-8330760
> 
> The cleanup() method flush stream and print summary which should be already printed by complain method.
> 
> This cleanup is not necessary and printing summary usually is just disabled. It is enabled if the test called 'complain' method. However, the error should have been printed already in this method.
> 
> So it would be simple to remove this cleanup and reduce usage of Finalizable in vmTestbase tests.
> 
> Note: The 'verboseOnErrorEnabled' is just not used.
> 
> See isVerboseOnErrorEnabled.
> 
>     public boolean isVerboseOnErrorEnabled() {
>         return errorsSummaryEnabled;
>     }
> 
> 
> Tested with by running tests with different combinations (tier4-7) and tier1.

Every log (as any Finalazible object) is registered using
registerCleanup()
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizable.java#L59
This function add object to FinalizerThread stack . This stack is processed  and method cleanup is called for each object during shutdown.
See 
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java#L105
for adding hook
and
https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java#L118
for processing methods.

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

PR Comment: https://git.openjdk.org/jdk/pull/19209#issuecomment-2108082162


More information about the serviceability-dev mailing list