Cannot access items or categories due to lock busy messages

Encountering slave or stale locks actually does not impact performance, but rather prevent proper access to objects.

Symptoms

While trying to work with objects, such as items or categories, you can see messages like the following:
Lock Busy for item
or
Checkout failed - the entry is
already locked by collaboration areas

Resolving the problem

Detect and delete invalid locks.
Note: This is for removing all locks. If you want to remove a lock for a specific item, you need to find the right item ID and row in the lck table. Then, customize an SQL statement to delete it.
  1. Back up the database.
  2. Shut down Product Master to guarantee we are not deleting good locks.
  3. Run SQLs A and B to check for stale slave and master locks;
    (A): select * from lck where LCK_TYPE='S';
    (B): select * from lck where LCK_TYPE='M' and (LCK_THREAD_ID != '-1' or LCK_JVM_ID != '-1');
  4. if (A) returns any rows, while Product Master is down, remove all slave locks.
    (C): delete from lck where LCK_TYPE='S';
  5. If (B) returns any rows, reset (LCK_THREAD_ID) or (LCK_JVM_ID) of any master lock to -1
    D): update lck set LCK_THREAD_ID = '-1', LCK_JVM_ID = '-1'
    where (LCK_THREAD_ID != '-1' OR LCK_JVM_ID != '-1') and LCK_TYPE='M';

    (F): commit;
  6. Restart Product Master.