Skip to content

A WinRM timeout causes a HTTP 500 but is not notified to OverthereProcessOutputHandler  #57

@zerikv

Description

@zerikv

Hello,

With OverThere 2.1.0-beta-1 (from Maven), I open a WinRM connection (CifsConnectionBuilder.CIFS_PROTOCOL) configured with a timeout to 10 secondes:

    options.set(CifsConnectionBuilder.WINRM_TIMEMOUT, "PT10.000S");

With this connection, a command line is requested, to execute a PowerShell which sleeps for 12 secondes.
Therefore the SOAP request falls in timeout.

    connection.execute(processOutHandler, CmdLine.build("powershell.exe", "-nonInteractive", "-command", "Start-Sleep -s 12;"));

I can see in the logs this timeout causes an HTTP response from the WinRM service with a HTTP code 500 (please, see logs below).
But the WinRMRuntimeIOException is catched and no handler of OverthereProcessOutputHandler is called.

I would need to intercept this kind of error.

What do you think about this issue?

Thank you for your advices.

10:57:42.371 [Process output reader for command [powershell.exe -nonInteractive -command "Start-Sleep -s 12;"] on [cifs:winrm://admin@TEST-SEVEN:445:5985]] TRACE c.x.o.c.w.c.ApacheHttpComponentsHttpClientHttpConnector - Header Content-Length: 1347
Exception in thread "Process output reader for command [powershell.exe -nonInteractive -command "Start-Sleep -s 12;"] on [cifs:winrm://admin@TEST-SEVEN:445:5985]" com.xebialabs.overthere.cifs.winrm.exception.WinRMRuntimeIOException: Send message on http://TEST-SEVEN:5985/wsman error , document in <?xml version="1.0" encoding="UTF-8"?>

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header>
    <a:To xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://TEST-SEVEN:5985/wsman</a:To>
    <a:ReplyTo xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <a:Address mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
    </a:ReplyTo>
    <w:MaxEnvelopeSize xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="true">153600</w:MaxEnvelopeSize>
    <a:MessageID xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">uuid:77193F42-36B1-413F-B425-4F1BEB25E1DC</a:MessageID>
    <w:Locale xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="false" xml:lang="en-US"/>
    <p:DataLocale xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" mustUnderstand="false" xml:lang="en-US"/>
    <w:OperationTimeout xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">PT10.000S</w:OperationTimeout>
    <a:Action xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive</a:Action>
    <w:SelectorSet xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
      <w:Selector Name="ShellId">61B4EFC1-35B5-45DF-BB87-8CE4E757C54D</w:Selector>
    </w:SelectorSet>
    <w:ResourceURI xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
  </env:Header>
  <env:Body>
    <rsp:Receive xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell">
      <rsp:DesiredStream CommandId="3393F071-7BC1-4FD9-963A-2878E892053C">stdout stderr</rsp:DesiredStream>
    </rsp:Receive>
  </env:Body>
</env:Envelope>
, document out [EMPTY],
    at com.xebialabs.overthere.cifs.winrm.connector.ApacheHttpComponentsHttpClientHttpConnector.doSendMessage(ApacheHttpComponentsHttpClientHttpConnector.java:268)
    at com.xebialabs.overthere.cifs.winrm.connector.ApacheHttpComponentsHttpClientHttpConnector.sendMessage(ApacheHttpComponentsHttpClientHttpConnector.java:119)
    at com.xebialabs.overthere.cifs.winrm.WinRmClient.sendMessage(WinRmClient.java:210)
    at com.xebialabs.overthere.cifs.winrm.WinRmClient.receiveOutput(WinRmClient.java:122)
    at com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection$1.run(CifsWinRmConnection.java:154)
Caused by: com.xebialabs.overthere.cifs.winrm.exception.WinRMRuntimeIOException: Response code was 500, document in [EMPTY], document out [EMPTY],10:57:42.373 [main] DEBUG c.x.overthere.cifs.winrm.WinRmClient - DeleteShell shellId 61B4EFC1-35B5-45DF-BB87-8CE4E757C54D

    at com.xebialabs.overthere.cifs.winrm.connector.ApacheHttpComponentsHttpClientHttpConnector.doSendMessage(ApacheHttpComponentsHttpClientHttpConnector.java:256)
    ... 4 more
10:57:42.374 [main] TRACE c.x.o.c.w.c.ApacheHttpComponentsHttpClientHttpConnector - Sending request to http://TEST-SEVEN:5985/wsman

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions