Microsoft Distributed Transaction Coordinator issue SQL Error: 8525, SQLState: S0001

Mike Gleeson 1 Reputation point
2022-09-28T15:47:32.237+00:00

Hi I have a Java Web application that uses Spring Framework and Angular as the frontend. Every time when we deploy a new war that updates our source then our application gets restarted on the first run of an api within the application we get the following SQL Error: 8525, SQLState: S0001 Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. I run the same api a second time and it works fine. also the first run seems very slow which makes me thing its blowing some time limit? i tried changing the deafult of 60 seconds in the component services for transactions to 3600. also we set default timeout on atomikos to 300 seconds. Any help with would be much appreciated. Thanks

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,707 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,552 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CathyJi-MSFT 21,091 Reputation points Microsoft Vendor
    2022-09-29T09:07:57.49+00:00

    Hi @Mike Gleeson ,

    > SQL Error: 8525, SQLState: S0001 Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.

    Quote from MS document.

    Explanation

    The programming model for using the Distributed Transaction Coordinator with SQL Server requires applications to explicitly enlist to and defect from a distributed transaction.
    This error occurs when the following four conditions are met:

    •The application has enlisted into a distributed transaction.
    •The transaction has ended, either committed or rolled back, for any reason.
    •The user application has not explicitly defected from a distributed transaction or explicitly enlisted into a new distributed transaction.
    •The application tries to do any transactional operation other than defecting from existing distributed transaction or enlisting to a new distributed transaction, such as issuing a query or starting a local transaction.

    Error state 1 is used when the application performs an operation that creates local transactions, and state 2 is used when application tries to enlist to a bound session.

    User Action

    After an application has enlisted into a distributed transaction, the application must explicitly defect from the distributed transaction or enlist to another distributed transaction. This will implicitly defect from a previous enlisted transaction.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".