Question
Michael Lundberg · Feb 20, 2018

How to avoid the process to get stuck in a Queue?

Hi!

We have problems in some productions where it stuck in a Queue when things goes wrong and i wonder if somebody have som tips to avoid it?

example when we got stuck is this:

set MyClass= ##class(SomeClass).%New(). MyClass has a Datefield

try
{
 
MyClass.Date =  Sourcedata.Date  //Sourcedata send us wrong format to that datefield. Error occur.

}

catch ex 
{
set tErrMsg = "Error i this method "  _ $System.Status.GetOneStatusText(ex.AsStatus())
$$$LOGERROR(tErrMsg)
Quit
}

In this case the catch-scope is not seems to be reached at all and the production get stuck in a Queue.

And this is pretty common for us also in operations if some request goes wrong.

Is there any common best practice to prevent or kill the queues?

Best regards,

Michael Lundberg

0
0 326
Discussion (5)1
Log in or sign up to continue

catch-scope is not seems to be reached

Have you enabled logging?

Error occurs on saving incorrect data and not on setting the data. Saving also does not throw an exception, only returns an error status.

Also you need to quit something:

#dim sc As %Status = $$$OK

try
{
  set myClass= ##class(SomeClass).%New()
  myClass.Date =  Sourcedata.Date  //Sourcedata send us wrong format to that datefield.
  set sc = myClass.%Save() // Error occurs on save.
} catch ex {
  set sc = ex.AsStatus()
  set errMsg = "Error in this method "  _ $System.Status.GetOneStatusText(sc)
  $$$LOGERROR(errMsg)
}
quit sc

On a side note, you're using 3 different naming conventions for variables in your snippet:

  • tHungarianNotation
  • CapitalCase
  • lowercase

It would probably be better to decide on one notation.

Hi and thanks for answer. It's not any explicit saving. It seems to happens  immediately at allocation of the value even if there are more properties to set after that line. And there is of course a Quit later

//Michael

How did you determine that problem happens directly at allocation (setting the property)?

I trace all lines and i never reach the line after (next property).  

Can you write

Sourcedata.Date 

into a global? What's its value?