cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL Error : There is already an open DataReader associated with this Command which must be closed first

Hey,

 

I'm using Nintex Workflow 3.0.7.0 with Sharepoint SP1 (the correct one)

I have workflow that has a switch action.

One of the branches create a task and does a couple of webrequest there after the workflow should be ended with end workflow action.

For Nintex the workflow has a completed state but for SharePoint the status is still In Progress.

I did notice that in the same milisecond 2 connections were opened to the Nintex SQLDatabase.

When I turn on the verbose logging for the Nintex product I found following errors.

Any ideas in how this can be solved?

 

Error establishing database connection.: System.Transactions.TransactionException: The operation is not valid for the state of the transaction. ---> System.Transactions.TransactionPromotionException: Failure while attempting to promote transaction. ---> System.Data.SqlClient.SqlException: There is already an open DataReader associated with this Command which must be closed first. ---> System.ComponentModel.Win32Exception: The wait operation timed out     -
-- End of inner exception stack trace ---   
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)   
at System.Data.SqlClient.SqlDelegatedTransaction.Promote()     -
-- End of inner exception stack trace ---   
at System.Data.SqlClient.SqlDelegatedTransaction.Promote()   
at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)   
at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)     -
-- End of inner exception stack trace ---   
at System.Transactions.TransactionState.EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)   
at System.Transactions.Transaction.EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)   
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)   
at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)   
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)   
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)   
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)   
at System.Data.SqlClient.SqlConnection.Open()   
at Nintex.Workflow.Administration.Database.OpenConnectionInternal(String connectionString)   
at Nintex.Workflow.Administration.ContentDatabase.OpenConnection()   
at Nintex.Workflow.Administration.Database.ExecuteReader(SqlCommand command, CommandBehavior behavior) (Build:3070)

and:

: Nintex.Workflow.NWException: Could not retrieve workflow name for instance id. ---> System.Transactions.TransactionException: The operation is not valid for the state of the transaction. ---> System.Transactions.TransactionPromotionException: Failure while attempting to promote transaction. ---> System.Data.SqlClient.SqlException: There is already an open DataReader associated with this Command which must be closed first. ---> System.ComponentModel.Win32Exception: The wait operation timed out     -
-- End of inner exception stack trace ---   
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)   
at System.Data.SqlClient.SqlDelegatedTransaction.Promote()     -
-- End of inner exception stack trace ---   
at System.Data.SqlClient.SqlDelegatedTransaction.Promote()   
at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)   
at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)     -
-- End of inner exception stack trace ---   
at System.Transactions.TransactionState.EnlistPromotableSinglePhase(InternalTransaction tx, IPromotableSinglePhaseNotification promotableSinglePhaseNotification, Transaction atomicTransaction)   
at System.Transactions.Transaction.EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification promotableSinglePhaseNotification)   
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)   
at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction)   
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)   
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)   
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)   
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)   
at System.Data.SqlClient.SqlConnection.Open()   
at Nintex.Workflow.Administration.Database.OpenConnectionInternal(String connectionString)   
at Nintex.Workflow.Administration.ContentDatabase.OpenConnection()   
at Nintex.Workflow.Administration.Database.ExecuteReader(SqlCommand command, CommandBehavior behavior)   
at Nintex.Workflow.NWWorkflowContext.DRs=(Guid Dhs=, SPWeb Dxs=, WorkflowCategory EBs=, WorkflowType& ERs=, String& Ehs=)     -
-- End of inner exception stack trace --- (Build:3070)

Labels: (1)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: SQL Error : There is already an open DataReader associated with this Command which must be closed first

Hi Thomas,

Doers this happen every time you run a workflow now, or was this one occurrence?

If it's a once off thing, I wouldn't worry about it unless it comes up again.  Maybe some sort of DB maintenance was going that locked the database and caused it to be in a weird state for a short amount of time.

If it happens all the time, I would recommend you go to Central Administration > Nintex Workflow Management > Database setup and see if there is a message there that says a DB upgrade is available.  If there is, click on the link provided there and that should upgrade the database and may help with this issue.

If the issue persists, please contact our support team - support@nintex.com

Cheers,

Vadim

0 Kudos
Accept as Solution Reply
Not applicable

Re: SQL Error : There is already an open DataReader associated with this Command which must be closed first

Hi Vadim,

Thanks for your answer.

There is no new version of nintex database required. Current version is : 3.0.0.5

I have it for every workflow that I run, but it is always at the same action.

It makes no difference if I use the standard To do task or I use my own custom task form, but I didn't find the cause of the issue.

A colleague of mine had created an eventreceiver on the tasklist that does some extra checks on the item. (not the task but the related content). At first I didn't think that could be the problem as when I debug through the event receiver there is no problem and everything is done like requested.

We even tried putting a delay in the workflow after the task completion and it still throws the error. The strange thing is that the actions after the task are executed only the End workflow action has trouble with it (probably becuase then there gets things committed to the related item)

Disabeling this eventreceiver makes the workflow complete succesfully.

We really do need do some extra checks as we are handling document processing and we need to be sure that the document is checked in before we continue. We also need to add an item in the audit trail so we can track at one place what happened with all documents.

If it is a custom task form I can put it in the onlick event handler but not all my tasks have custom forms.

I'm not sure what we are doing wrong!

Is it allowed to have Itemupdating/ itemupdated eventreceivers on the tasklistitem while a workflow is running?

I hope you can help.

Kind Regards,

Thomas

0 Kudos
Accept as Solution Reply
Not applicable

Re: SQL Error : There is already an open DataReader associated with this Command which must be closed first

What kind of update action been involved in Itemupdating/ itemupdated eventreceivers? Can you post some code snippet?

0 Kudos
Accept as Solution Reply
Not applicable

Re: SQL Error : There is already an open DataReader associated with this Command which must be closed first

I had also contacted Nintex support directly.

 

They told me that Custom event receivers on the task list are not supported by Nintex.

 

To solve the issue we created custom task forms.

0 Kudos
Accept as Solution Reply