Windows KTM/TxF: Can durable abort win against an outstanding commit within a fixed deadline?

Kashif Kazi 20 Reputation points
2026-09-29T03:04:12.5366667+00:00
I need clarification on a Windows transaction/durability guarantee for a fail-closed user-mode system.  

Environment:
- Windows
- User-mode application
- Native Win32/NT filesystem operations
- Considering KTM/TxF, ESE, or another supported Windows mechanism

Scenario: 
One logical transaction can end in exactly one authoritative state:

1. COMMITTED — a durable effect becomes authoritative
2. REVOKED — the transaction is irreversibly closed and the pending effect
   must never later become authoritative

The difficult case is when a durable commit is already outstanding when
revocation is requested.

For example:

    durable commit starts
        ↓
    commit is still pending
        ↓
    application deadline is reached
        ↓
    revocation/abort is requested

I need a durable ordering mechanism where exactly one side wins.

If REVOCATION wins, an already-running or stale actor must not later be able
to make its pending effect authoritative, even if that process or I/O request
continues running.

My requirement is NOT that all processes or I/O physically terminate within
the deadline.

The requirement is that the application can establish an irreversible,
crash-recoverable "revocation won" state within a 5-second closure reserve.

My question is:

Does Windows provide a supported mechanism — KTM/TxF, ESE, or another
facility — where a competing durable commit and revocation share one
authoritative ordering domain, and where revocation can be proven to have won
within a documented finite time bound without waiting indefinitely for the
outstanding commit to complete?

The two intended uses are:

- preventing a pending filesystem publication/rename from becoming
  authoritative after revocation;
- accepting exactly one durable terminal result, while rejecting stale results
  after revocation.

I am specifically trying to distinguish:

- abort/revocation requested;
- abort/revocation actually won;
- commit actually won;
- caller observed completion;
- durability established;
- crash-recovery outcome.

A timeout, process termination, or cancellation request alone is not sufficient
for my requirement.

If Windows provides durable ordering but intentionally provides NO documented
finite upper bound for commit/abort completion, confirmation of that would also
answer the question.

Pointers to the relevant Microsoft documentation would be appreciated.

Windows development | Windows API - Win32
0 comments No comments

Answer accepted by question author
Taki Ly (WICLOUD CORPORATION) 5,630 Reputation points Microsoft External Staff Moderator
2026-09-29T03:13:37.6133333+00:00

Hello @Kashif Kazi ,

Thank you for the detailed write-up. I checked the Windows documentation against each part of your requirement, and I want to be direct about what the platform does and does not guarantee.

I would not recommend building this on KTM/TxF. Microsoft's Alternatives to using Transactional NTFS page states that TxF may not be available in future versions of Windows and strongly recommends investigating alternatives rather than adopting it.

Even setting deprecation aside, KTM does not give you what you are asking for. CommitTransaction can only be called while the transaction is still active, and the Timeout parameter of CreateTransaction only aborts the transaction if it has not already reached the prepared state. In other words, KTM does give you a single ordering domain with exactly one outcome, but once a commit has been issued and the transaction has passed the prepared point, there is no documented path for a later abort to override it. RollbackTransaction is documented only as synchronous, with no completion bound, and the KTM programming model explicitly tells you never to assume a transaction is active because it can be rolled back at any time.

ESE is a healthier choice for durability, but it has the same shape. JetCommitTransaction waits for the log flush by default, so the transaction is durable when the call returns, and any transaction committed with JET_bitCommitLazyFlush that was not flushed before a crash is automatically aborted during recovery in JetInit. However, ESE likewise cannot roll back a commit that has already been issued, and it does not document a time bound for commit completion.

So, to answer your closing question directly: Windows provides durable ordering with one outcome per transaction, but it does not document a finite upper bound for commit or abort completion in KTM/TxF or ESE, and it does not provide any mechanism where an abort is guaranteed to win over an already-issued durable commit.

What I would recommend instead is to own the ordering domain in your application and stop treating the in-flight commit as the thing that needs to be blocked. Make the authoritative fact a single durable terminal-state record that both sides must write atomically; whoever lands the record first wins, and the loser observes it and stands down. Concretely, I would keep one small file per logical transaction (for example txn\<id>.state), write it to a temp file, call FlushFileBuffers, and then publish it with MoveFileEx using MOVEFILE_REPLACE_EXISTING and MOVEFILE_WRITE_THROUGH, or with ReplaceFile. A same-volume NTFS rename is atomic, so exactly one writer creates the record. If you prefer ESE, a JetInsert on a unique key achieves the same thing because the second writer receives JET_errKeyDuplicate.

The important design rule is that the published payload is never the authority. Consumers only trust the published file when the record says COMMITTED, and any actor must read the record before publishing; if it says REVOKED the actor must not publish, and a rename that completes late is harmless because nothing treats it as authoritative. On crash recovery you scan the records: a present record is the truth, and an absent record means REVOKED, which keeps you fail-closed with no in-doubt state. This also gives you the six distinctions you listed. A request is the write attempt, revocation winning is the rename or insert succeeding, commit winning is finding the other side's record already present, caller observation is the API returning, durability is established after the write-through or the non-lazy ESE commit, and the crash-recovery outcome is simply the presence and content of the record.

On the 5-second reserve, I want to be honest: revocation under this design is one small write plus one rename, which completes in milliseconds in practice, but Windows does not document an upper bound for any disk I/O, including write-through. If the deadline is hard, I would enforce it at the application layer, for example by treating "not confirmed within the reserve" as REVOKED, which is consistent with your fail-closed requirement.

If you need a formal written guarantee beyond what the public documentation states, that would require a Microsoft Developer Support case, since I can only speak here to what is documented. You can open a professional support request through Microsoft Support for Business.

I hope this helps. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.

Thank you.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.