protheus-locks-deadlocks
About protheus-locks-deadlocks
A reference skill for developers diagnosing and preventing locking problems in Protheus. It explains the hybrid record-locking model, transaction-scoping practices, and live diagnostics for supported database engines.
Key features
- 01Protheus locking model and API semantics
- 02Safe transaction scoping patterns
- 03Lock ordering and contention prevention
- 04Live lock and deadlock diagnostics
- 05Database-engine-specific SQL checks
Use cases
- 01Investigating a record-locked error
- 02Diagnosing contention under concurrent load
- 03Reviewing code that locks records
- 04Planning batch jobs with lock ordering
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ thalysjuvenal/ advpl-specialist --skill protheus-locks-deadlocksAfter installing, type/protheus-locks-deadlocksin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
diagnostics.mdpatterns-prevention.mdreference.mdDetails
From the project READMEProtheus Locks & Deadlocks
This skill documents the Protheus hybrid locking model -- record-level Workarea locks (RecLock/MsUnlock) coordinated by DBAccess on top of the underlying RDBMS (PostgreSQL, MSSQL, Oracle) -- and how to diagnose and prevent the lock leaks, contention, and deadlocks that are among the most common production issues. It covers lock API semantics (RecLock, MsUnlock/MsUnlockAll, SoftLock, LockByName, TCSqlExec, BeginTran/EndTran/DisarmTransaction), safe transaction scoping with BEGIN SEQUENCE/RECOVER, and live diagnostic procedures per database engine.
Activate this skill when the user reports a "Record locked by user XYZ" error, needs to investigate performance degradation under concurrent load, is writing or reviewing code that locks records, or is designing a batch job over large data sets where lock ordering matters. It does not cover query design or %nolock% usage in Embedded SQL (see query-builder), general runtime/performance debugging unrelated to locking (see advpl-debugging), or BeginSQL/EndSQL macro syntax (see embedded-sql).
| Reference file | Read when |
|---|---|
| reference.md | Always -- lock types table, core lock/transaction APIs, when-to-use guidance |
| patterns-prevention.md | Writing or refactoring code that locks records -- BEGIN SEQUENCE/RECOVER, SoftLock, transaction scoping, lock ordering rules |
| diagnostics.md | Investigating live lock contention or deadlocks -- TopMemoStatus, MonitorActiveLocks, DBAccess monitor, engine-specific SQL lock queries |