Hi all,
I am using HSLJson library to parse a JSON returned from an API call.
My method works when called in singleton, but when I loop over it, it always fails on the 8th iteration (regardless of the number of vials. ie 9 or 10 or 11 vials).
When it fails, the entire Vantage method stops without error handling or cleaning up. The run history status still says ‘running’ but the run control window says ‘completed’. I often need to restart the Vantage to get everything
online again.
I’ve traced out all steps in the procedure below and it reliably stops on the same HSLJson (line 686, GetStringProperty of HSLJson). But this same code works the 7 times before it!
Apologies in advance for the length, but since the looping causes the error, I’d like to include the entire loop:
Part 1
Initialize HSLHttp object. Bring the array with the number of barcodes (tubes) in from main method. Begin the loop over each barcode.
Part 2
Send the request to ELN to get the UUID of the container from Barcode. This loops twice if it does not go through. The UUID is required for editing container details.
Part 3 (where the method stops on the 8th iteration)
Line 677: A new HSLJson object is created
Line 679: JSON response from HSLHttp is parsed into HSLJson object
Line 681: JSON array element is saved to same HSLJson object
Line 683: JSON property is retrieved from array element above
Line 686: “id” value is saved to a string. THIS IS WHERE IT CRASHES (only after 7 successes).
Line 688: JSON object is released each iteration.
Part 4
Error handling and sending a PATCH to shell.
These seem to work fine, but I included them incase I need to be closing the shell or file in a different way that might impact memory…
Part 5
The second PATCH to shell. Same as Part 4 but under a different end point. Seems to work fine but I’m unfamiliar with best memory handling practices.
Any glaring errors? To me it feels like a memory leak because of the way it just exits, this is supported by the loop compiling the leak. I released the JSON and HTTP (thats not shown in my code but I did and tested after reading the post) so I cant see any other place that a leak could be happening. Are they not releasing?
Is there a way I can trace the object contents or view them?
Thank you all for all your incredible support!!!
Kyle