New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default Transaction blocks the whole application on each request #7688
Comments
I would say that if you are doing an update on a table and the action takes a long time, then the database will lock the table during the whole transaction, right. |
Ok, i tracked it down. The module AlexZh.WindowsAuthentication includes a file
The module implements windows authentication. After a user has been signed in (*1) the module calls the user event handlers (*2) which results in a call to The following exception is displayed when the
What is going wrong here? Any idea? |
Maybe try to put a breakpoint in the transaction manager to see if two threads are trying to create a new one. |
Yes, i will enable the logs, good idea, thx. But i dont understand your statement: "Maybe try to put a request in the transaction manager to see if two threads are trying to create a new one.". Can you elaborate? |
Updated my comment (breakpoint). |
Setting a breakpoint in So i enabled NHibernate Logging and the following queries are logged right before the exception occurs:
As we can see, first the current user is queried, then the parts. Afterwards |
Found it! The issue is as follows: Session A
-> transaction A is still open with the Session B (e.g. in another browser):
-> After reading Data Modifications under Read Committed Snapshot Isolation (RCSI turned on as suggested by @pszmyd here in my initial post) it's clear why this happens. The So this issue affects a specific user only. Now, what would be the right approach to tackle this? |
I assume the only thing to do is ensure the tables are not locked when a long operation is executed. So start by committing the current one, then do the long operation, and finally open a new one just for the necessary time. |
Will do, thx. |
Hi there,
let me put a bit of context first: after upgrading from1.9.2 to 1.10.1 the application couldn't handle requests executed at the same time (we got timeouts as soon as 2 users startet a request at the same time). As far as i can remember i googled around and after a while i found a post by @pszmyd recommending setting the snapshot isolation level to a certain value (see here). After i did this the application worked again but after a while i recognized that when a long operation takes place (e.g. in a controller action) the whole application is blocked until the long operation finishes (even when using async actions).
Then i remembered a paragraph of the Orchard docs stating that a DB transaction is created for each request. Therefore i injected
ITransactionManager
in my controller and calledITransactionManager.Cancel()
in the action first and suddenly Orchard is back on track and can handle multiple requests at the same time:Therefore i assume its a DB transaction / configuration issue. My assumption: as long as a transaction is open no other can read from the DB.
I don't feel comfortable calling
ITransactionManager.Cancel()
all over the place. Also this approach won't work when basic Orchard functionality is concerned, e.g. on saving a content item -> handlers are called -> a handler might take a longer time to process the content item -> here i cannot callITransactionManager.Cancel()
.What could possibly cause the DB blocking and how can i fix this?
So lonG
The text was updated successfully, but these errors were encountered: