'Run command extension execution is in progress. Please wait for completion before invoking a run command

I am trying to execute a script on multiple VM(2 servers for now) from Azure devops pipeline. Invocation of script is being done via Invoke-AzureRmVMRunCommand.

My issues: on first VM command is executing without any issues. But on second VM, I am getting below error:


2019-07-21T08:35:00.5804498Z ##[error]Run command extension execution is in progress. Please wait for completion before invoking a run command. ErrorCode: Conflict

ErrorMessage: Run command extension execution is in progress. Please wait for completion before invoking a run command.

StatusCode: 409

ReasonPhrase: Conflict

OperationID : a7f0e50a-4f53-4d3b-84bf-35b7637d6df0

How can I avoid this error?



Solution 1:[1]

Answering my own question:

Looks like one of the VM had some hung processes. When I rebooted both VMs, the VM which had issue generated an output file before restart.

Post restart, I am not getting the same issue again. Please look from this angle also If you are facing this issue.

Solution 2:[2]

Restart or Wait for 2hrs to timeout

You can restart the server if possible, or you can wait 2hrs to timeout the session.

Solution 3:[3]

I actually ran into this problem- although I had no other pipelines running simultaneously and my VMs in azure all appeared fine- I went ahead and did a restart on all in the resource group that would be affected. When I verified their restart succeeded, I re-ran the pipeline without issue.

"Did you try turning it off and on again?"

                -Moss (The IT Crowd)

Solution 4:[4]

Well- I ran into this- and it was happening because I had 4 pipelines- and I was kicking them off manually, simultaneously. They each had a restore DB action that was trying to happen at the same time.

Only kick off your pipelines that restore DBs on the same VMs one at a time.

Solution 5:[5]

Solution 1: you can see what commands is executed in Azure portal below, then you can cancel the running command.

Solution 2: directly shutdown your VM, then start it and try to run commands again.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vijay
Solution 2 Community
Solution 3 j-cousineau
Solution 4 j-cousineau
Solution 5 bluetata