none
CloseSession throws NullReferenceException

    Question

  • Hi,

    I am working a service running on HPC 2016 Update 1.

    From client node, I am able to submit task and task finished. But task stayed on running state. Checking the event log, I can see there is null reference exception. 

    Further investigating, I found the null reference exception is raised in CloseSession. The stack trace is:

       at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
       at Microsoft.Hpc.Scheduler.Session.V3Session.CloseSession(String headNode, Int32 sessionId, Binding binding, Boolean isAadUser)
       at Microsoft.Hpc.Scheduler.Session.Session.CloseSession(String headnode, Int32 sessionId, Boolean isAadUser)

       at user code to call CloseSession.

    The exception source is: Microsoft.Threading.Tasks.

    Microsoft.Threading.Tasks version is 1.0.168.0

    HPC SDK version 5.1.6124.

    May I get some suggestions? Thanks.


    Wednesday, October 10, 2018 7:31 PM

Answers

  • Hi,

    Thanks for the repro steps. We have identified that this is a bug in our SDK. A possible fix has been proposed. We'll inform you once the fix is available.

    Thanks,
    Zihao

    • Marked as answer by danieljzhang Wednesday, October 24, 2018 7:57 PM
    Thursday, October 18, 2018 5:53 AM

All replies

  • Hi,

    What binding are you used in you SOA service? Which version of .net framework you are using?

    Thanks,
    Zihao

    Thursday, October 11, 2018 2:27 AM
  • <system.serviceModel>
        <bindings>
          <netTcpBinding>
            <binding name="myBinding"
                     receiveTimeout="24.00:00:00"
                     portSharingEnabled="true"
                     maxBufferSize="262144"
                     maxReceivedMessageSize="262144">
              <security mode="Transport" />
              <readerQuotas maxStringContentLength="65536" />
            </binding>
            <!--binding used by broker's backend-->
            <binding name="Microsoft.Hpc.BackEndBinding" maxConnections="1000">
              <!--for non domain joined compute nodes, the security mode should be None-->
              <security mode="Transport">
                <transport clientCredentialType="Windows" protectionLevel="None"/>
              </security>
            </binding>
          </netTcpBinding>
        </bindings>
      </system.serviceModel>

    netTcpBinding is what we used for HPC 2008 and HPC 2012. BackEndBinding is what I added for HPC 2016 (I have to add them for some HPC regression).

    Our code is compiled in VS 2010. The target framework is .NET Framework4.

    Thursday, October 11, 2018 2:17 PM
  • Hi,

    We can not locally reproduce this issue. Could you add following xml to your app.config, and provide us the log produced?

      <system.diagnostics>
    	<trace autoflush="true" useGlobalLock="false">
    		<listeners>
    			<remove name="Default" />
    			<add name="xmlt" />
    		</listeners>
    	</trace>
    	<sharedListeners>
    		<add name="xmlt" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "c:\TEMP\trace.svclog" />
    		<add name="xml" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "c:\TEMP\session.svclog" />
    		<add name="xmls" type="System.Diagnostics.XmlWriterTraceListener" initializeData= "c:\TEMP\hpcsoa.svclog" />
    	</sharedListeners>
    	<sources>
    		<source name="SOA Session API" switchValue="All">
    			<listeners>
    				<remove name="Default" />
    				<add name="xml"/>
    			</listeners>
    		</source>    
    		<source name="HpcSoa" switchValue="All">
    			<listeners>
    				<remove name="Default" />
    				<add name="xmls" />
    			</listeners>
    		</source>
    	</sources>
      </system.diagnostics>

    Thanks,

    Zihao

    Friday, October 12, 2018 4:06 AM
  • Thanks Zihao.

    I figured out how to replicate this issue.

    1. Get HPC 2012 SDK batch example.

    2. Update HPC sdl with 5.1.6124 using nuget.

    3. Change the session.Close(true) to Session.CloseSession("10.xx.xx.xx", sessionId ) in ResponseRecevier

    This static call CloseSession will throw exception.

    Wednesday, October 17, 2018 3:31 PM
  • Hi,

    Thanks for the repro steps. We have identified that this is a bug in our SDK. A possible fix has been proposed. We'll inform you once the fix is available.

    Thanks,
    Zihao

    • Marked as answer by danieljzhang Wednesday, October 24, 2018 7:57 PM
    Thursday, October 18, 2018 5:53 AM
  • Hi,

    A new version of HPC Pack SDK is published. Please find it at https://www.nuget.org/packages/Microsoft.HPC.SDK/5.2.6281

    Thanks,
    Zihao

    Friday, October 19, 2018 6:35 AM