On Wed, 10 Jun 2026 18:20:26 GMT, Coleen Phillimore <[email protected]> wrote:

>> Please review this change to allow XX configuration for specifying a 
>> different /tmp directory for the JVM to use.  In some container 
>> environments, /tmp and /proc/pid/root/tmp might not be usable and an 
>> alternate would be used.  This requires a release note and CSR.   Usage is:
>> 
>> java -XX:AltTempDir=/diags <app>
>> jps -J-XX:AltTempDir=/diags
>> jcmd -J-XX:AltTempDir=/diags <pid> <cmds>
>> 
>> Tested with a couple of tests and locally, and ran tier1-4.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Coleen Phillimore has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   os:snprintf returns size of the concatenated string even if it doesn't 
> concatenate the strings.  Added a test and improved the error message.

src/hotspot/os/posix/attachListener_posix.cpp line 352:

> 350:                        os::get_temp_directory(), 
> os::current_process_id());
> 351:   if (n > (int)UNIX_PATH_MAX) {
> 352:     log_warning(attach)("Failed to create temporary file for attach 
> %s/.java_pid%d file name too long",

Suggestion:

    log_warning(attach)("Failed to create temporary file for attach 
%s/.java_pid%d: file name too long",

test/jdk/com/sun/tools/attach/JvmTempDirTest.java line 209:

> 207:         String[] args = new String[] { "-XX:AltTempDir=" + tmpDir, 
> "-version" };
> 208:         OutputAnalyzer output = ProcessTools.executeTestJava(args);
> 209:         output.shouldContain("[warning][attach] Failed to create 
> temporary file for attach");

This should probably be converted to `shouldMatch` with wildcards to allow for 
extra spaces in the log decorators - there is an open PR changing a bunch of 
tests due to this potential problem.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31407#discussion_r3393019400
PR Review Comment: https://git.openjdk.org/jdk/pull/31407#discussion_r3393024117

Reply via email to