Skip to contentSkip to conversation

qga-win: Increase VSS freeze timeout to 60 secs instead of 10

PATCH In review Basil Salman 3 participants 12 messages Apr 5, 2021 – Jul 28, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 qga-win: Increase VSS freeze timeout to 60 secs instead of 10

Currently Requester freeze times out after 10 seconds, while
the default timeout for Writer Freeze is 60 seconds. according to
VSS Documentation [1].
[1]: https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +1 -1
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10 seconds) */
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
Signature · 1 line
2.17.2
#1 lore raw

PATCH 2/3 qga-win: Fix build_guest_fsinfo() close of nonexistent handle

On the current error path of build_guest_fsinfo(), a non existent handle is passed to CloseHandle().
This patch add initialization of hLocalDiskHandle to INVALID_HANDLE_VALUE, and checks for handle validity before the handle is closed.

---
 qga/commands-win32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
qga/commands-win32.c +4 -2
index 27baf17d6c..d51833ef15 100644
@@ -1091,7 +1091,7 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
     size_t len;
     uint64_t i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes;
     GuestFilesystemInfo *fs = NULL;
-    HANDLE hLocalDiskHandle = NULL;
+    HANDLE hLocalDiskHandle = INVALID_HANDLE_VALUE;
 
     GetVolumePathNamesForVolumeName(guid, (LPCH)&mnt, 0, &info_size);
     if (GetLastError() != ERROR_MORE_DATA) {
@@ -1149,7 +1149,8 @@ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
     fs->type = g_strdup(fs_name);
     fs->disk = build_guest_disk_info(guid, errp);
 free:
-    CloseHandle(hLocalDiskHandle);
+    if (hLocalDiskHandle != INVALID_HANDLE_VALUE) {
+        CloseHandle(hLocalDiskHandle);
+    }
     g_free(mnt_point);
     return fs;

}

Signature · 1 line
2.17.2
#2 lore raw

PATCH 3/3 qga-win: Fix handle leak in ga_get_win_product_name()

In reply to Basil Salman

In ga_get_win_product_name() a handle to Registry key was open but not closed.
In this patch the handle is closed as part of the free routine.

---
 qga/commands-win32.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
qga/commands-win32.c +7 -2
index d51833ef15..8cea3ec0f8 100644
@@ -2229,7 +2229,7 @@ static char *ga_get_win_name(OSVERSIONINFOEXW const *os_version, bool id)
 
 static char *ga_get_win_product_name(Error **errp)
 {
-    HKEY key = NULL;
+    HKEY key = INVALID_HANDLE_VALUE;
     DWORD size = 128;
     char *result = g_malloc0(size);
     LONG err = ERROR_SUCCESS;
@@ -2239,7 +2239,8 @@ static char *ga_get_win_product_name(Error **errp)
                       &key);
     if (err != ERROR_SUCCESS) {
         error_setg_win32(errp, err, "failed to open registry key");
-        goto fail;
+        g_free(result);
+        return NULL;
     }
 
     err = RegQueryValueExA(key, "ProductName", NULL, NULL,
@@ -2260,9 +2261,12 @@ static char *ga_get_win_product_name(Error **errp)
         goto fail;
     }
 
+    RegCloseKey(key);
     return result;
 
 fail:
+    if (key != INVALID_HANDLE_VALUE) {
+        RegCloseKey(key);
+    }
     g_free(result);
     return NULL;

}

Signature · 1 line
2.17.2
#3 lore raw
In reply to Basil Salman

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2

#4 lore raw

ping

Quoted 36 lines · Konstantin Kostiuk

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2

#5 lore raw
In reply to Konstantin Kostiuk

Quoting Konstantin Kostiuk (2021-04-22 02:43:25)

Quoted 1 line

ping

I've been trying to get these queued but I'm hitting an issue where qga reports:

failed to load qga-vss.dll: The specified module could not be found.

via LoadLibraryA(QGA_VSS_DLL) returning error code 126. What's weird is it seems to find qga-vss.dll in the install directory, and you can see it access it in WinDBG and various trace tools, but somehow it reports not found. Are you seeing this issue?

I'll debug more this week and try to get these in for rc1, but if you happen to have more of a clue than me then any insights would be much appreciated.

Quoted 35 lines · Basil Salman
    Currently Requester freeze times out after 10 seconds, while
    the default timeout for Writer Freeze is 60 seconds. according to
    VSS Documentation [1].
    [1]: https://docs.microsoft.com/en-us/windows/win32/vss/
    overview-of-processing-a-backup-under-vss

    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1909073

    Signed-off-by: Basil Salman <[email protected]>
    Signed-off-by: Basil Salman <[email protected]>
    ---
     qga/vss-win32/requester.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
    index 5378c55d23..940a2c8f55 100644
    --- a/qga/vss-win32/requester.cpp
    +++ b/qga/vss-win32/requester.cpp
    @@ -18,7 +18,7 @@
     #include <inc/win2003/vsbackup.h>

     /* Max wait time for frozen event (VSS can only hold writes for 10
    seconds) */
    -#define VSS_TIMEOUT_FREEZE_MSEC 10000
    +#define VSS_TIMEOUT_FREEZE_MSEC 60000

     /* Call QueryStatus every 10 ms while waiting for frozen event */
     #define VSS_TIMEOUT_EVENT_MSEC 10
    --
    2.17.2
#6 lore raw

Hi Michael,

qga-vss.dll has many dependencies. Please check that all DLLs are present in the same directory.

Also, I have a similar problem in my setup. In my case, libgcc_s_seh-1.dll was renamed in MinGW which I used.

Best wishes,
Kostiantyn Kostiuk

Quoted 54 lines · Michael Roth

Quoting Konstantin Kostiuk (2021-04-22 02:43:25)

Quoted 1 line

ping

I've been trying to get these queued but I'm hitting an issue where qga reports:

failed to load qga-vss.dll: The specified module could not be found.

via LoadLibraryA(QGA_VSS_DLL) returning error code 126. What's weird is it seems to find qga-vss.dll in the install directory, and you can see it access it in WinDBG and various trace tools, but somehow it reports not found. Are you seeing this issue?

I'll debug more this week and try to get these in for rc1, but if you happen
to have more of a clue than me then any insights would be much appreciated.

Quoted 11 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]: https://docs.microsoft.com/en-us/windows/win32/vss/
overview-of-processing-a-backup-under-vss

Quoted 7 lines

---
qga/vss-win32/requester.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/vss-win32/requester.cpp

b/qga/vss-win32/requester.cpp

Quoted 17 lines
    index 5378c55d23..940a2c8f55 100644
    --- a/qga/vss-win32/requester.cpp
    +++ b/qga/vss-win32/requester.cpp
    @@ -18,7 +18,7 @@
     #include <inc/win2003/vsbackup.h>

     /* Max wait time for frozen event (VSS can only hold writes for 10
    seconds) */
    -#define VSS_TIMEOUT_FREEZE_MSEC 10000
    +#define VSS_TIMEOUT_FREEZE_MSEC 60000

     /* Call QueryStatus every 10 ms while waiting for frozen event */
     #define VSS_TIMEOUT_EVENT_MSEC 10
    --
    2.17.2
#7 lore raw

ping

Quoted 70 lines · Konstantin Kostiuk

Hi Michael,

qga-vss.dll has many dependencies. Please check that all DLLs are present in the same directory.

Also, I have a similar problem in my setup. In my case, libgcc_s_seh-1.dll was renamed in MinGW which I used.

Best wishes,
Kostiantyn Kostiuk

Quoted 55 lines · Michael Roth

Quoting Konstantin Kostiuk (2021-04-22 02:43:25)

Quoted 1 line

ping

I've been trying to get these queued but I'm hitting an issue where qga reports:

failed to load qga-vss.dll: The specified module could not be found.

via LoadLibraryA(QGA_VSS_DLL) returning error code 126. What's weird is it seems to find qga-vss.dll in the install directory, and you can see it access it in WinDBG and various trace tools, but somehow it reports not found. Are you seeing this issue?

I'll debug more this week and try to get these in for rc1, but if you happen
to have more of a clue than me then any insights would be much appreciated.

Quoted 11 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]: https://docs.microsoft.com/en-us/windows/win32/vss/
overview-of-processing-a-backup-under-vss

Quoted 7 lines

---
qga/vss-win32/requester.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/vss-win32/requester.cpp

b/qga/vss-win32/requester.cpp

Quoted 17 lines
    index 5378c55d23..940a2c8f55 100644
    --- a/qga/vss-win32/requester.cpp
    +++ b/qga/vss-win32/requester.cpp
    @@ -18,7 +18,7 @@
     #include <inc/win2003/vsbackup.h>

     /* Max wait time for frozen event (VSS can only hold writes for 10
    seconds) */
    -#define VSS_TIMEOUT_FREEZE_MSEC 10000
    +#define VSS_TIMEOUT_FREEZE_MSEC 60000

     /* Call QueryStatus every 10 ms while waiting for frozen event */
     #define VSS_TIMEOUT_EVENT_MSEC 10
    --
    2.17.2
#8 lore raw
In reply to Basil Salman

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2

#9 lore raw
In reply to Basil Salman

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2

#10 lore raw
In reply to Basil Salman

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2

#11 lore raw

ping

Quoted 36 lines · Konstantin Kostiuk

ping

Quoted 32 lines · Basil Salman

Currently Requester freeze times out after 10 seconds, while the default timeout for Writer Freeze is 60 seconds. according to VSS Documentation [1].
[1]:
https://docs.microsoft.com/en-us/windows/win32/vss/overview-of-processing-a-backup-under-vss

---
 qga/vss-win32/requester.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qga/vss-win32/requester.cpp +0 -0
index 5378c55d23..940a2c8f55 100644
@@ -18,7 +18,7 @@
 #include <inc/win2003/vsbackup.h>
 
 /* Max wait time for frozen event (VSS can only hold writes for 10

seconds) */

qga/vss-win32/requester.cpp +1 -2
-#define VSS_TIMEOUT_FREEZE_MSEC 10000
+#define VSS_TIMEOUT_FREEZE_MSEC 60000
 
 /* Call QueryStatus every 10 ms while waiting for frozen event */
 #define VSS_TIMEOUT_EVENT_MSEC 10
--

2.17.2