Re-add check for Invoke-Command job dispose.#11388
Re-add check for Invoke-Command job dispose.#11388anmenaga merged 3 commits intoPowerShell:masterfrom PaulHigin:fix-session-reconnect-regression
Conversation
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Code change looks fine, possible to add a local loopback test?
|
Regarding automated tests, the repro requires abruptly disconnecting a synchronous running Invoke-Command (Invoke-Command -AsJob does not exhibit the problem). This is moderately easy to do interactively, but difficult for an automated CI test since it involves multiple processes and timing. My concern is creating yet another fragile test that fails randomly, adding unnecessary misery to build engineers. |
|
Actually, I thought about this some more and have found a simpler way to test this scenario. I feel the test should be reasonably reliable and will add it here. We can always remove the test if it turns out to be fragile. |
|
🎉 Handy links: |
PR Summary
This fixes session reconnect regression bug: #11150.
PR Context
Invoke-Command creates a disconnected job object to facilitate session re-connection, when WinRM abruptly disconnects the session due to network issues. The EndProcessing() block was disposing the disconnected job object so that a session reconnect could not occur.
Fix is to add the checks back in the code which prevents EndProcessing() from disposing the disconnected job, and added comments explaining why the code checks are there.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.