Skip to content
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

Timeout on UpdateAndCommitAsync() #9

Closed
hexpl0it opened this issue Jan 22, 2019 · 3 comments
Closed

Timeout on UpdateAndCommitAsync() #9

hexpl0it opened this issue Jan 22, 2019 · 3 comments

Comments

@hexpl0it
Copy link

I'm trying to run the Database example. I use a SqlServer but when i try to do the UpdateAndCommitAsync() an execption throw up.

// This will echo multiple Update data events to the Console because it impacts multiple records in the resultset
// Yes, that's pretty cool :)
Console.WriteLine("Updating user name to 'Mr. Spongebob'");
await database.UpdateAndCommitAsync("users", new
{
        id = spongebobId,
        name = "Mr. Spongebob"
});
await Task.Delay(500);  

This is the stack trace.

at Butterfly.SqlServer.SqlServerDatabase.ExecuteCommandAsync[T](Func`2 query, String executableSql, Dictionary`2 executableParams) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 268
 at Butterfly.SqlServer.SqlServerDatabase.DoSelectRowsAsync(String executableSql, Dictionary`2 executableParams, Int32 limit) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 73
 at Butterfly.Core.Database.Dynamic.DynamicView.GetImpactedRecordsAsync(KeyValueDataEvent keyValueDataEvent) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicView.cs:line 252
 at Butterfly.Core.Database.Dynamic.DynamicViewSet.StoreImpactedRecordsInDataEventTransaction(TransactionState transactionState, DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 115
 at Butterfly.Core.Database.Dynamic.DynamicViewSet.ProcessUncommittedDataEventTransactionAsync(DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 100
 at Butterfly.Core.Database.BaseDatabase.PostDataEventTransactionAsync(TransactionState transactionState, DataEventTransaction dataEventTransaction) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 147
 at Butterfly.Core.Database.BaseTransaction.CommitAsync() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseTransaction.cs:line 258
 at Butterfly.Core.Database.BaseDatabase.UpdateAndCommitAsync(String updateStatement, Object vars) in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 257
 at ConsoleApp1.Program.Run(IDatabase database) in c:\users\marcoc\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 151
@johan-v-r
Copy link
Collaborator

Which version of SQL Server are you running?
Also thanks for the stack trace, but please provide the rest of the exception as well. Hopefully something useful in there.

@hexpl0it
Copy link
Author

I'm using the version 2012.

Full stack :
Butterfly.Core.Database.DatabaseException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at Butterfly.SqlServer.SqlServerDatabase.<ExecuteCommandAsync>d__171.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 275
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Butterfly.SqlServer.SqlServerDatabase.<DoSelectRowsAsync>d__9.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.SqlServer\SqlServerDatabase.cs:line 73 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Butterfly.Core.Database.Dynamic.DynamicView.d__21.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicView.cs:line 252
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Butterfly.Core.Database.Dynamic.DynamicViewSet.<StoreImpactedRecordsInDataEventTransaction>d__23.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 115 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Butterfly.Core.Database.Dynamic.DynamicViewSet.<ProcessUncommittedDataEventTransactionAsync>d__21.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\Dynamic\DynamicViewSet.cs:line 100 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Butterfly.Core.Database.BaseDatabase.<PostDataEventTransactionAsync>d__46.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 147 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Butterfly.Core.Database.BaseTransaction.<CommitAsync>d__27.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseTransaction.cs:line 258 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Butterfly.Core.Database.BaseDatabase.<UpdateAndCommitAsync>d__60.MoveNext() in C:\Users\marcoc\Desktop\butterfly-server-dotnet-master\Butterfly.Core\Database\BaseDatabase.cs:line 257 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at ConsoleApp1.Program.d__1.MoveNext() in c:\users\marcoc\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 151`

@johan-v-r
Copy link
Collaborator

Could you possibly try to set your Isolation Level just to see if that solves the problem?

ALTER DATABASE MyDatabase  
SET ALLOW_SNAPSHOT_ISOLATION ON  
  
ALTER DATABASE MyDatabase  
SET READ_COMMITTED_SNAPSHOT ON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants