Utilizzando Entity Framework, ho ricevuto una serie di le seguenti eccezioni la scorsa notte in una delle mie applicazioni:System.Data.EntityException: Il provider sottostante fallito su Commit
System.Data.EntityException: The underlying provider failed on Commit. --->
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior
to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
at System.Data.SqlClient.TdsParserStateObject.ReadByte()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
at System.Data.SqlClient.SqlInternalTransaction.Commit()
at System.Data.SqlClient.SqlTransaction.Commit()
at System.Data.EntityClient.EntityTransaction.Commit()
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityTransaction.Commit()
at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
La cosa interessante di questo errore è che il i dati sono stati effettivamente scritti nel database. I found a related post on a MS site sembrava indicare che si trattava di un errore relativo alla rete.
Alcune domande che potrei usare assistenza sono:
- Quali opzioni devo disturbare il tiro questo errore?
- E 'più probabile che sia collegato alla rete o il DB potrebbe essere un sospetto?
- Come posso sapere dal codice se la transazione è stata effettivamente completata?
- Devo interrogare il DB su questo errore per verificare se il successo o semplicemente riprovare la transazione?
- Se riprovo la transazione, come può essere eseguita automaticamente con Entity Framework o semplicemente riprendo/riprovo?
- Quali altri articoli dovrei guardare?
Grazie in anticipo.
UPDATE
Usando Ignite for SQL siamo stati in grado di determinare che un processo di SQL secondario da un altro gruppo è stato monopolizzando la CPU impedendo la nostra applicazione di funzionare correttamente. In breve, stiamo andando avanti con l'aggiunta di un server secondario per prevenire ulteriori conflitti tra i due team.
Ciò che è ancora interessante dell'eccezione è che la transazione è effettivamente riuscita, piuttosto che fallita.
So che è passato molto tempo, ma puoi approfondire come hai usato Ignite per SQL? Nel mio caso non sempre accade, quindi è difficile sapere quando guardare il server. – gitsitgo
Non posso dire di essere un ignite guru; abbiamo un team di prestazioni DB che gestisce questa roba. Posso dire che quello che cerco di solito quando ottengo problemi di prestazioni sono le istruzioni top di sql (come gli stati di accensione "le barre grandi"). Queste sono in genere le query che eseguono il hogging di tutto. Da lì si tratta di mettere a punto quelle domande. Mi dispiace di non poter fornire più specifiche che stai cercando. In bocca al lupo. – Randy