If the FIRST api call to the HPC REST service is 'CreateJob' then the service crashes
- Dominant language
- PowerShell
- Stars
- 34
- Forks
- 19
- Avg merge
- 41m
- Merged PRs (30d)
- 4
Description
See here for additional info:
https://learn.microsoft.com/en-us/answers/questions/5557372/how-to-fix-error-when-using-the-hpc-rest-api-getti
#### Problem Description
When invoking a rest API to create a job in HPC, the job is created correctly the first time. Any subsequent API calls result in an error.
Error log:
`HandleException System.ObjectDisposedException: Safe handle has been closed Server stack trace: at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean& success) at System.StubHelpers.StubHelpers.SafeHandleAddRef(SafeHandle pHandle, Boolean& success) at Microsoft.Win32.Win32Native.GetTokenInformation(SafeAccessTokenHandle TokenHandle, UInt32 TokenInformationClass, SafeLocalAllocHandle TokenInformation, UInt32 TokenInformationLength, UInt32& ReturnLength) at System.Security.Principal.WindowsIdentity.GetTokenInformation(SafeAccessTokenHandle tokenHandle, TokenInformationClass tokenInformationClass) at System.Security.Principal.WindowsIdentity.get_User() at System.Security.Principal.WindowsIdentity.GetName() at System.Security.Principal.WindowsIdentity.get_Name() at Microsoft.Hpc.Scheduler.Store.SchedulerAuthMessageHeader.OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) at System.ServiceModel.Channels.Message.WriteMessagePreamble(XmlDictionaryWriter writer) at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer) at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota) at System.ServiceModel.Channels.BinaryMessageEncoderFactory.BinaryMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset) at System.ServiceModel.Channels.FramingDuplexSessionChannel.EncodeMessage(Message message) at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSendCore(Message message, TimeSpan timeout) at System.ServiceModel.Channels.TransportDuplexSessionChannel.OnSend(Message message, TimeSpan timeout) at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.Hpc.Scheduler.Store.ISchedulerStoreInternal.Job_VerifyId(ConnectionToken token, Int32 jobId, StoreProperty[]& existingProps) at Microsoft.Hpc.Scheduler.Store.StoreServer.CallServerFuncWithErrorHandling(Func`1 action, Boolean asyncReconnect)`
#### Steps to Reproduce
**If you perform the following scenario, the REST API works as expected:**
1. Restart the HPC REST Service
2. _Invoke a get jobs operation, e.g. GET https:///HPC/Jobs_
3. Invoke a create HPC job operation e.g. POST https:///HPC/Jobs
4. Invoke a create HPC task operation e.g. POST https:///HPC/Tasks
5. **The task is created OK.**
**If you perform the following scenario, the REST API WILL BREAK:**
1. Restart the HPC REST Service
2. Invoke a create HPC job operation e.g. POST https:///HPC/Jobs
_The REST service will exception and write the errors above to the log._
3. Invoke a create HPC task operation e.g. POST https:///HPC/Tasks
4. **STEP 3 WILL TIME OUT! No further messages can be communicated with the service until it is restarted.**
Note that the only difference between the scenarios is that the first message to the service after start is a GET (list jobs) operation as opposed to a Create Job POST operation.
This behavior is consistently reproducible.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.