What does HRESULT 0xC00E009C (MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION) mean?

 
Previous Next
MQ_ERROR_MESSAGE_NOT_AUTHENTICATED ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS

MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION

Why the exact HRESULT matters

MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION belongs to the Message Queuing HRESULT facility, but its useful meaning is narrower than a generic messaging failure. In this case the decisive subject is message is reserved by an unresolved transaction. Until commit or abort, another transaction cannot consume or move the same message.

For MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, MSMQ supports internal single-queue transactions and coordinated transactions involving MS DTC. When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, queue type, destination locality, receive locality, and ambient transaction propagation constrain which operations are valid.

Transaction identifiers and completion ownership are essential. In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, two threads attempting to commit, abort, or consume the same locked message can turn a recoverable application bug into duplicate processing.

Subsystem context

SubsystemMSMQ internal or coordinated transactions and their MS DTC enlistment
Decisive boundarytransaction type, queue locality, operation order, and enlistment state determine whether the action is legal
Code-specific focusmessage is reserved by an unresolved transaction
Primary recovery ruleFind the owning transaction and wait/recover it; duplicate consumers cannot force the lock away.

When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, A transport retry is not equivalent to transaction recovery. In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, first determine whether the unit of work committed, aborted, remains in doubt, or never enlisted. For MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, the code-specific boundary is message is reserved by an unresolved transaction.

Minimum useful telemetry

  • Queue transactional flag and local/remote placement; associate it explicitly with MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION.
  • When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, begin, enlist, send/receive, prepare, commit, and abort timestamps; capture the value before cleanup or retry changes it.
  • In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, transaction identifier and whether it is internal, ambient, or dtc-coordinated; compare it with a known-good call using the same account and queue type.
  • For this MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION result, record the queue path or format name, local/remote placement, transactional flag, caller SID, process build, and UTC correlation ID when they apply.

For MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, log certificate thumbprints, provider names, SIDs, GUIDs, lengths, and hashes where useful, but do not log private keys, symmetric keys, credentials, or confidential message bodies.

Step-by-step diagnosis

  1. Record the unsigned HRESULT, MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, and the native API or COM method before a framework replaces it with a generic exception.
  2. When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, capture begin, enlist, send/receive, prepare, commit, and abort timestamps.
  3. In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, capture transaction identifier and whether it is internal, ambient, or DTC-coordinated.
  4. Reproduce with the smallest queue/message/property set that still returns MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION; change one precondition at a time.
  5. For MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, verify the postcondition after the failed call: queue existence, message presence, directory object state, transaction outcome, or generated output may differ by result.
  6. When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, apply the code-specific recovery rule: Find the owning transaction and wait/recover it; duplicate consumers cannot force the lock away.

Retry and cleanup

Find the owning transaction and wait/recover it; duplicate consumers cannot force the lock away.

When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, do not hide this HRESULT behind an unlimited framework retry. In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, require a verified precondition change and preserve the original correlation identifier across the next attempt.

Avoiding a false diagnosis

In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, do not convert the operation to a nontransactional send merely to suppress the HRESULT; that changes delivery and atomicity guarantees. The specific focus for MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION remains message is reserved by an unresolved transaction.

  • In the MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION path, A successful test under an interactive administrator account does not prove that the production service account has the same profile, token, directory access, or key permissions.
  • For this MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION result, restarting MSMQ before collecting evidence can invalidate handles and erase the first useful event; it is a containment action, not a root-cause diagnosis.

Example

An order processor using msmq and sql encounters MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION. For MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, it correlates the MSMQ call with the DTC transaction ID and final outcome before replaying business work. When diagnosing MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, the acceptance test then changes only the decisive precondition and confirms both the HRESULT and the actual queue/message state.

A regression test should force MQ_ERROR_MESSAGE_LOCKED_UNDER_TRANSACTION, assert the raw value and relevant outputs, then correct only the documented precondition and verify the intended success or neighboring HRESULT.

References


Looking for a different code? Search another status or error code.