Question
Anderson F · Apr 1

How to find out which Class/ClassMethod is causing lock on a specific table?

Hello everybody.

My question originated when trying to help a coworker...

There is a system module, specifically a ClassMethod that inserts records into a table as per the pseudocode below:

set Obj = ##class(FooSchema.FooTable).%New()
set Obj.fooProp = fooValue
// Other Foo properties //
set status = Obj.%Save()

From time to time, when trying to save the object, an error , informing that it was not possible to obtain the exclusive lock on the table instance

I want, using objectscript, to find out which other part of the system (Classmethod) is causing the lock on this table

Reading the documentation, I found %SYS.LockQuery, but the closest I got was figuring out which owner/pid caused the lock...

Is there any way, through this PID, to extract the information I need? Or, is there another way to solve this issue?

Every help is welcome

Product version: Caché 2018.1
0
0 81
Discussion (2)1
Log in or sign up to continue

Once you know the pid, try:

set process = ##class(%SYS.ProcessQuery).%OpenId(pid)

Then check process.Routine, or process.CurrentLineAndRoutine.

This is what I needed, thank you so much for your help