Published on InterSystems Developer Community (https://community.intersystems.com)

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

Question
Anderson F · Apr 1, 2022

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

#ObjectScript #Caché
Product version: Caché 2018.1

Source URL:https://community.intersystems.com/post/how-find-out-which-classclassmethod-causing-lock-specific-table