"VBoxManage guestcontrol run" timeouts

Discussions about using Windows guests in VirtualBox.
Post Reply
pepus
Posts: 3
Joined: 10. Dec 2019, 15:01

"VBoxManage guestcontrol run" timeouts

Post by pepus »

While testing the behavior of vboxmanage guestcontrol run I noticed random timeouts happening. I wrote a script to further investigate this issue. It basically just executes the command 1000 times and counts non zero exit states with a fixed timeout of 1s (should be plenty for a simple echo "hi").

For cmd Iam using

Code: Select all

vboxmanage guestcontrol w10 run --exe C:\\Windows\\System32\\cmd.exe --timeout 1000 --username testuser --password testuser --wait-stdout -- cmd.exe /c echo hi 
For powershell

Code: Select all

vboxmanage guestcontrol w10 run --exe C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe --timeout 1000 --username testuser --password testuser --wait-stdout -- powershell.exe -InputFormat none -NoLogo -NonInteractive -NoProfile -Command echo hi 
Running my test script I usually encounter 10-20 timeouts for both variants.

I am running vbox 5.2.34_Ubuntur133883 on my host system. Guest additions 5.2.34 on the Windows client (10.0.18362).

Any ideas how to decrease the number of random timeouts happening? If you require more information / logs I will try to provide anything required to solve this.
 Edit:  
Using --no-wait-stdout "solves" this problem - so its seems to root cause has something to do with output redirection.

Simple test script (tests run for like 15min)

Code: Select all

#!/bin/bash

readonly ITERATIONS=1000
readonly ITERATION_PROGRESS=$((ITERATIONS/10))
readonly ITERATION_PERC=$((ITERATIONS/100))

function print_progress {
  if [ $(($1 % $ITERATION_PROGRESS)) -eq 0 ]; then 
    echo -n "...$(($1 / $ITERATION_PERC))"
  fi 
}

echo "#################################"
echo "Starting powershell test suite"
echo "#################################"
fail_counter=0
start=$(date +%s)
for i in $(seq 1 $ITERATIONS) ; do
  if ! vboxmanage guestcontrol w10 run --exe C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe --timeout 1000 --username testuser --password testuser --wait-stdout -- powershell.exe -InputFormat none -NoLogo -NonInteractive -NoProfile -Command echo hi > /dev/null 2>&1; then
    ((++fail_counter))
  fi
  print_progress $i 
done
end=$(date +%s)
echo ""
echo "timeouts: $fail_counter"
echo "runtime: $((end-start))"
echo ""

echo "#################################"
echo "Starting cmd test suite"
echo "#################################"
fail_counter=0
start=$(date +%s)
for i in $(seq 1 $ITERATIONS) ; do
  if ! vboxmanage guestcontrol w10 run --exe C:\\Windows\\System32\\cmd.exe --timeout 1000 --username testuser --password testuser --wait-stdout -- cmd.exe /c echo hi > /dev/null 2>&1; then
    ((++fail_counter))
  fi
  print_progress $i 
done
end=$(date +%s)
echo ""
echo "timeouts: $fail_counter"
echo "runtime: $((end-start))"
Last edited by socratis on 17. Dec 2019, 20:28, edited 2 times in total.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: "VBoxManage guestcontrol run" timeouts

Post by socratis »

Glad you figured out the "--no-wait-stdout" switch, that's why I guess it's there for. ;)

Marking as [Resolved].
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
pepus
Posts: 3
Joined: 10. Dec 2019, 15:01

Re: "VBoxManage guestcontrol run" timeouts

Post by pepus »

Well Iam actually not really happy about that switch since it may or may not hide the command output. While the command output may not required sometimes, it is NO solution for the problem.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: "VBoxManage guestcontrol run" timeouts

Post by socratis »

What would constitute a solution to the problem in your opinion?
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
pepus
Posts: 3
Joined: 10. Dec 2019, 15:01

Re: "VBoxManage guestcontrol run" timeouts

Post by pepus »

A way to

1) Get the command output and
2) Reduce the random timeouts

would be nice.

Maybe there is a more reliable way to get the command output or a switch that makes it work better.

The powershell version is already using a not really documented command line switch to make it work (-InputFormat none) as mentioned here: viewtopic.php?f=6&t=47946 but it is still not really reliable.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: "VBoxManage guestcontrol run" timeouts

Post by socratis »

Unmarked as [Resolved].
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply