RFR: 8256489: Make gtest for long path names on Windows more resilient in the presence of virus scanners

David Holmes dholmes at openjdk.java.net
Tue Nov 24 01:27:58 UTC 2020


On Mon, 23 Nov 2020 10:41:47 GMT, Ralf Schmelter <rschmelter at openjdk.org> wrote:

> Hi,
> 
> a virus scanner can keep a file open on Windows, so that a DeleteFile command returns successful, but the file is actually not removed when the call returns. In the gtest for long path names on Windows this can lead to failures when a directory is tried to be removed, but the file inside it is still kept by the virus scanner.
> 
> Since this is an error which only occurs very infrequently, we just retry the deletion a few times. 
> 
> Best regards,
> Ralf

Seems a problem that will exist in a few places e.g. ./logging/logTestUtils.inline.hpp

A couple of minor nits below.

Thanks,
David

test/hotspot/gtest/runtime/test_os_windows.cpp line 138:

> 136:   WITH_ABS_PATH(path);
> 137:   EXPECT_TRUE(file_exists_w(abs_path)) << "Can't delete directory: \"" << path << "\" does not exists";
> 138:   const int max_wait_time = 20;

This isn't a "wait time" it is a retry count.

test/hotspot/gtest/runtime/test_os_windows.cpp line 141:

> 139: 
> 140:   // If the directory cannot be deleted directly, a file in it might be
> 141:   // kept by a virus scanner. Try a few times, since this should be temporary.

s/kept/kept open/

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

Marked as reviewed by dholmes (Reviewer).

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


More information about the hotspot-runtime-dev mailing list