DeleteFromQuery timeout exception
Since v4.0.87 the DeleteFromQuery function has not worked in my application. It works fine in v4.0.86.
Exception Message: A timeout error occured. Please increase the timeout globally: ctx.Database.CommandTimeout = 60; or BulkOperationManager.BulkOperationBuilder = operation => operation.BatchTimeout = 60; or by operation: q.DeleteFromQuery(operation => operation.BatchTimeout = 60);
Stack Trace:
at .Execute(List1 actions) at .(List1 )
at Z.BulkOperations.BulkOperation.()
at Z.BulkOperations.BulkOperation1.DeleteFromQuery(IQueryable originalQuery, IQueryable query) at DbContextExtensions.[](IQueryable1 , Action1 , CancellationToken ) at DbContextExtensions.DeleteFromQuery[TEntity](IQueryable1 query, Action1 bulkOperationFactory) at DbContextExtensions.DeleteFromQuery[TEntity](IQueryable1 query)
at Repository.StarReview.Repositories.ProductRepository.DeleteProductFamilyProducts(Int32 productFamilyId) in [code files/locations removed]
Further technical details
- EF version: 6.4.4
- Database Provider: MS SQL Server 2017
- .Net Framework v4.7.2
Hello @mideus ,
How do you set your command timeout?
It will help us to try to verify and test if we found an issue.
Best Regards,
Jon
I don't actually set it anywhere so it's just using the default EF timeout.
Hello @mideus ,
Sorry for the delay, we currently don't find any difference between both versions.
The same timeout is currently taken.
How long normally take the v4.0.86? Do both versions generate the same SQL on your side or there is a slight difference?
If you could provide a runnable project with the issue ([email protected]), it would be the best as we will be easily able to reproduce it and find quickly the cause of the problem.
Can you advise on how I could go about providing a runnable project? This involves calls to a database to get data, massage it, update and delete. I can't give you access to our databases or any data in it and I can't share proprietary code.
Hello Mideus,
Let start with by comparing the SQL then, it will probably be easier for you
Here is an example of how you can log and get the SQL (which include the current timeout): https://dotnetfiddle.net/rvWWYw
If you need, you can also send it in private here: [email protected]
I also added an options in comment: options.InternalIsEntityFrameworkPlus = true;
When enabling that option, the same code as EF Plus will be used which is faster (we will eventually need to stop using the old code to use only the same code as EF Plus).
If I use the sample code in that link and uncomment the options.InternalIsEntityFrameworkPlus= true line then my code works fine on the latest version. I don't understand your last comment about it using the same code as EF Plus and eventually needing to stop using old code.
I'm also sending an email with generated SQL.
FYI - After today I will be offline until 12/28. I will keep an eye out for updates for the next couple hours. Otherwise, I look forward to following up then.
(Answered by email)