Page 1 of 1

"VBoxManage guestcontrol run" timeouts

Posted: 10. Dec 2019, 15:20
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))"

Re: "VBoxManage guestcontrol run" timeouts

Posted: 12. Dec 2019, 19:22
by socratis
Glad you figured out the "--no-wait-stdout" switch, that's why I guess it's there for. ;)

Marking as [Resolved].

Re: "VBoxManage guestcontrol run" timeouts

Posted: 13. Dec 2019, 13:52
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.

Re: "VBoxManage guestcontrol run" timeouts

Posted: 13. Dec 2019, 19:23
by socratis
What would constitute a solution to the problem in your opinion?

Re: "VBoxManage guestcontrol run" timeouts

Posted: 14. Dec 2019, 15:05
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.

Re: "VBoxManage guestcontrol run" timeouts

Posted: 17. Dec 2019, 20:29
by socratis
Unmarked as [Resolved].