deadlock - Handle NHibernate Transaction Errors -
The use of our application (which NHibernate and ASP.NET MVC), the stress placed NHibernate transaction errors under trials Throws a lot. The main types are:
Q How do we manage sessions and transactions?
A. For each server request we are using Autofack, we create a new request container in which the session is in the container lifetime, we activate the transaction when we activate the session. When the request is complete, we do the transaction. In some cases, the transaction may be huge. To simplify, every server is contained in a transaction in the request.
Look at this thread:
Actually what is the reason for this exception As says:
2010-02-17 21: 01: 41,204 Warning NHibernate.Util.ADOExceptionReporter - System.Data.SqlClient SqlException: The transaction log for the database 'database name' is filled. Find out why it can not be used to log into space again, maybe you see log_reuse_wait_desc column sys.databases
transactions made during the transaction, such as the size of the log function Is the proportional to the amount of, in the order bookers' handling on the part of the transaction, the limits of their transaction of orders should be included. You will then load the state with session # X, which you want to mutate, mutate and commit it, all this is a unit of work in #X.
In relation to the reading side of things, you may have another Christian # that reads the data; This ISession can be used for batch, reads in the example, with the repetitive or futures facility, something else can be read from a cache similarly (it is actually a crutch). Doing this can help you overcome "errors" which are not; Livelocks, deadlocks and victim transactions.
The problem with using a transaction for a request is that your Issation maintains many functions when you are working, which is part of all transactions, therefore participate in database transactions, Marks of datas (rols, columns, tables, etc.) as a wait-graph reason that crosses the database (not in the database-sense, not the DDD sense), which are not actually part of the
record (Other people have stopped it), Fabian The data layer was working to deal with exceptions. Citing some of their code;
public class MsSqlExceptionConverterExample: ISQLExceptionConverter {public exception Convert (AdoExceptionContextInfo exInfo) {var sqle = ADOExceptionHelper.ExtractDbException (exInfo.SqlException) as SqlException; If (sqle = null!) {Switch (sqle.Number) {case 547: return new ConstraintViolationException (exInfo.Message, sqle.InnerException, exInfo.Sql, null); Case 208: Return the new SQL Gamram Express (XInfo Message, Excel.InException, XInfo SQL); Case 3960: Return the new Stale ObjectState Expansion (exInfo.EntityName, exInfo.EntityId); }} Return SQLStateConverter. Handlen Special Expression (exInfo.SqlException, exInfo.Message, exInfo.Sql); The exception of 547 is the number of exceptions to the conflict. 208 has an exception number in an invalid object name in SQL. Exception number of snapshot isolation transaction has been revoked due to conflict of conflict. So if you are running compatibility issues like what you describe; Remember that they will cancel your resignation and you have to handle them as above.
The CQRS, where you read and write separately, can help:,.
To summarize; Your problems can be related to the way you control your transactions. Also, try to run from sys.databases from log_wait_reuse_desc where name = 'MyDBName'
and see what it gives you.
Comments
Post a Comment