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

RunspacePool close fail #53

Open
AndrewTsao opened this issue Sep 18, 2019 · 5 comments
Open

RunspacePool close fail #53

AndrewTsao opened this issue Sep 18, 2019 · 5 comments

Comments

@AndrewTsao
Copy link

Hi, I am start a long run command on remote host. After a long time , I close runspace pool, get this error, and I can't stop pssession on remote host.

requests_credssp.exceptions.AuthenticationException: Server did not response with a CredSSP token after step Step 5. Delegate Credentials - actual ''

How to run a long task with pypsrp?

@jborean93
Copy link
Owner

How long is long? It sounds like there's some sort of timer on the session from the server and when you go to run the last command it times out.

@AndrewTsao
Copy link
Author

About 120 seconds, Server is Windows Server 2012R2, Client is Win7.

from pypsrp.powershell import PowerShell, RunspacePool
from pypsrp.wsman import WSMan

if __name__ == "__main__":
    wsman = WSMan('192.168.5.31',
                    username='user',
                    password='passwd',
                    port=5985,
                    auth="credssp",
                    ssl=False)
    pool = RunspacePool(wsman)
    pool.open()
    shell = PowerShell(pool)
    shell.add_script(
        r'Start-Job -ScriptBlock { python.exe -c"import time;time.sleep(1000)" }'
    )
    shell.add_cmdlet("Out-String").add_parameter("Stream")
    output = shell.invoke()
    if shell.had_errors:
        log.error(shell.streams.error[0])
    print('\n'.join(output))

    import time
    time.sleep(120)
    pool.close()

@jborean93
Copy link
Owner

Cool so not something that is really long so this should work, let me try it out when I get a chance to see if I can replicate it.

@jdrowne
Copy link

jdrowne commented Mar 28, 2021

We are seeing a similar behavior when uploading a file to a Windows Server 2016.

@jdrowne
Copy link

jdrowne commented Mar 31, 2021

@jborean93 so we found out what the issue was in our case: it is on the client side rather than on the server side. We were trying to upload the same file to multiple servers simultaneously. It was not working. We had to use throttle: 1 in Ansible to ensure the upload was done in serial. The culprit was the win_copy module.

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

3 participants