[v6.x backport] vm: backport fix race condition with `timeout` param
This is a backport of PR #13074 for v6.x
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
vm