RSJob State does not reflect actual state of job #95

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

Projects

None yet

4 participants

@oldlost
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
Owner
proxb commented Sep 8, 2016

Thanks!

@proxb proxb added the help wanted label Nov 10, 2016
@proxb
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 proxb added a commit that referenced this issue Jan 14, 2017
@proxb Updates to module
#119 #95 #111 resolved
d63d68c
@proxb
Owner
proxb commented Jan 14, 2017

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

@platta
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
Owner
proxb commented Jan 25, 2017 edited

@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
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
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
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
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 Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment