Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell runbooks on hybrid workers can access other jobs variables if too many jobs are running at the same time #108

Open
guinoronha2 opened this issue Mar 19, 2024 · 0 comments

Comments

@guinoronha2
Copy link

guinoronha2 commented Mar 19, 2024

Hi! We have some user onboarding/offboarding scripts that run on hybrid workers. Sometimes, when there are several jobs running at the same time on the same hybrid worker, a script will eventually be able to read data from another job that is running at the same time.

A simplified example:

1 $Var1 = "1"
2 if ($Var1 -eq "1") {
3	$Email = "user@company.com"
4 }
5
6 .\ChildScript.ps1 -parameter1 "something" -parameter2 $Email

In Job 1, $Var1 is "1", so $Email will be created and populated with "user@company.com".

In Job 2, $Var1 is "6", so $Email is never created. It should be $null all along the script.

Expected behavior: In Job 2, line 6 will send nothing in parameter2.
What happens: If there are many jobs running at the same time, sometimes Job 2 will send "user@company.com" on line 6, which is an e-mail that was assigned to $Email in Job 1.

It doesn't happen every time, but we were able to consistently trigger this by sending several jobs (50 to 80) at the same time.

Shouldn't the variables be sandboxed in it's own powershell process?

Additional info, in case it makes any difference:

  • Hybrid workers are extension based and running on Windows Server 2012 R2
  • The real scripts contains several get-aduser and set-aduser commands
  • When $Var1 is "1", there is a connection to an on-premises exchange server via $Session = New-PSSession and Import-PSSession $Session
  • Runtime Version is Powershell 5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant