On Thu, 5 Nov 2026 17:10:54 GMT, Yunbo Zhang <[email protected]> wrote:

>> Please review this small fix.
>> 
>> Configuring the same log file as `vm.log`, `$PWD/vm.log`, and `./vm.log` 
>> creates separate outputs, splitting the messages across multiple files.
>> 
>> **Fix:**
>> 
>> Let each output match its own name through `matches_name()`. For file 
>> outputs, also check `os::same_files()` so different paths to the same file 
>> reuse the existing output.
>> 
>> **Testing:**
>> 
>> - Added `TestEquivalentLogFilePaths.java`.
>> - `gtest:LogConfiguration/server`: 21 passed, 0 failed.
>> - `test/hotspot/jtreg/serviceability/logging`: 7 passed, 0 failed.
>> - `test/hotspot/jtreg/runtime/logging`: 33 passed, 0 failed.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Yunbo Zhang has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains five additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into JDK-8392135
>  - 8392135: Unified logging creates extra log files
>  - 8392135: Unified logging creates extra log files
>    
>    Synchronize file identity comparisons with rotation using the existing 
> semaphore, and add a concurrent alias-matching regression test.
>  - 8392135: Unified logging creates extra log files
>    
>    Use virtual output name matching instead of identifying output types by 
> name prefixes and downcasting. Add coverage for file and standard output 
> matching.
>  - 8392135: Unified logging creates extra log files

I think that this PR just introduces a different bug.

Let's say that I do something like this:

1. Create JVM with logging at `active.log`
2. I create a hard link, `alias.log`, pointing to `active.log`
3. I use `jcmd VM.log` to configure some logging to go to `alias.log`.
4. The JVM sees that `active.log` and `alias.log` point to the same inode, so 
the `active.log` output is reused by UL (**YOUR CHANGE**)
5. Rotation renames `active.log` and create a new `active.log`
6. BUT! `alias.log` will still point to the old inode, not the new inode

So we switch from this path aliasing bug to being confused about hard links.

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

PR Comment: https://git.openjdk.org/jdk/pull/33090#issuecomment-7172686247

Reply via email to