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

RSJob State does not reflect actual state of job #95

Closed
oldlost opened this issue Sep 8, 2016 · 9 comments
Closed

RSJob State does not reflect actual state of job #95

oldlost opened this issue Sep 8, 2016 · 9 comments

Comments

@oldlost
Copy link
Contributor

oldlost commented Sep 8, 2016

When creating RSJobs, all objects begin with State of Running even though the actual state should be NotStarted. Only when a job actually begins execution should its state be set to Running.

The other states appear to be correct.

@proxb proxb added the bug label Sep 8, 2016
@proxb proxb self-assigned this Sep 8, 2016
@proxb
Copy link
Owner

proxb commented Sep 8, 2016

Thanks!

@proxb
Copy link
Owner

proxb commented Dec 4, 2016

I've solved this issue and just need to implement it within the module. https://learn-powershell.net/2016/12/04/tracking-the-state-of-powershell-runspaces-in-a-runspacepool/

proxb added a commit that referenced this issue Jan 14, 2017
@proxb
Copy link
Owner

proxb commented Jan 14, 2017

@oldlost This should be fixed now, please test and let me know the results.

@platta
Copy link

platta commented Jan 24, 2017

@proxb I just grabbed the latest version today. When I call Start-RSJob all the jobs are in a state of NotStarted and they remain in that state indefinitely, even though the job itself executes (I can see the downstream actions the jobs are taking). Wondering if that could be an issue introduced by the change made for this issue.

I'm going to do some digging tomorrow to see if I can provide more information, but I wanted to drop a note in case you have an ah-ha moment and already know what is happening.

@proxb
Copy link
Owner

proxb commented Jan 25, 2017

@platta Thanks for the heads up on this. I'm going to also take a look and see if I can duplicate the issue. Just out of curiosity, what version of PowerShell are you running? Did you download the module from the PowerShell gallery or from GitHub?

@proxb
Copy link
Owner

proxb commented Jan 25, 2017

i did a very simple demo to see what would happen and it appears to be working as expected on PowerShell V5 on Windows 10.

PS C:\WINDOWS\system32> 1..10|ssj {start-sleep 10}

Id       Name                 State           HasMoreData  HasErrors    Command
--       ----                 -----           -----------  ---------    -------
1        Job1                 Running         False        False        start-sleep 10
2        Job2                 Running         False        False        start-sleep 10
3        Job3                 Running         False        False        start-sleep 10
4        Job4                 Running         False        False        start-sleep 10
5        Job5                 Running         False        False        start-sleep 10
6        Job6                 NotStarted      False        False        start-sleep 10
7        Job7                 NotStarted      False        False        start-sleep 10
8        Job8                 NotStarted      False        False        start-sleep 10
9        Job9                 NotStarted      False        False        start-sleep 10
10       Job10                NotStarted      False        False        start-sleep 10

I'll try some other tests to see what happens.

@platta
Copy link

platta commented Jan 25, 2017

The first time it happened I was on 2008 R2 using V4. This morning I was able to reproduce it on Windows 10 using V5. Both those times I had downloaded the source through a browser from the GitHub page. Using Install-Module or the download link in the project's readme both gave me a working example.

Here's the fun part - Git diff shows that all versions of the module are identical, so after all that testing I re-extracted the original zip that gave me "broken" behavior. Now it works. I can no longer reproduce the issue. I replaced the module with a copy downloaded using the link in the readme on the 2008 R2 machine and now that one works too.

I give up!

@proxb
Copy link
Owner

proxb commented Jan 25, 2017

Weird! I'm glad that it is working now but odd that it happened all of a sudden without any real updates to the code or environment. Maybe we can just mark it as gremlins in the system? :)

@MVKozlov
Copy link
Contributor

sometime ago I have such gremlin when I have two module versions: from gallery and manually installed from github into other catalog

@proxb proxb closed this as completed Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants