-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
Exception on long running migration when using TransactionKind.CommitAll #280
Comments
This is happening to me, The solution should be easy, add a new property "AmbientTransactionTimeout" in the Evolve class and pass it to the TransactionScope constructor. Could you take a look at it? This is a feature we would love to see working properly. |
I created a PR |
This will only fix the issue if the timeout is under 10m (the max transaction default timeout). If you need it higher than that then the reflection hack is needed. If this were to be done in the library I think the max timeout could be modified before the migrations run then set back to the initial value. |
I just pushed a commit with the change. Check out if you can. |
Im the one that created the PR, just changed to my main account. When this will be released? |
@danigt91 Already done: #293 (comment) |
Long running migrations (10m+) with Evolve 3.0 on Postgres in Azure (v11) with Npgsql 6.0.6 (.NET 6) throw the following exception:
The connection parameters for timeouts we use are
CommandTimeout=900;InternalCommandTimeout=-1;
. It works fine if usingTransactionKind.CommitEach
. It always seems to happen after about 60000-70000 ms.I've tried debugging the issue and it seems the cause is this part:
The ambient transaction has its own timeout of 60000ms which matches with the time after which the exception is thrown. I tried changing that block to:
and this seems to solve the problem but it breaks the
TransactionKind.RollbackAll
mode. But the idea would be to handle the transaction at the connection level since then it would respect the connection string parameters.Modifying the timeouts for the ambient transaction might be possible as well but it seems to be tricky (see dotnet/runtime#1418 (comment)) and it did not work for me when I tried it (perhaps I didn't call the methods at the appropiate time). I'm also not sure if it would work with timeouts set in the connection string parameters, I think it would need the
CommandTimeout
parameter to be set explicitly in Evolve.EDIT: the
TransactionKind.CommitAll
works with the reflection hack if both max and default are set (along with the cached and validated members).The text was updated successfully, but these errors were encountered: