rebus-org / Rebus.SqlServer

:bus: Microsoft SQL Server transport and persistence for Rebus
https://mookid.dk/category/rebus
Other
43 stars 42 forks source link

Async deadlock in EnsureTablesAreCreated #20

Closed JornWildt closed 6 years ago

JornWildt commented 6 years ago

In SqlServerSagaStorage.cs we have this little piece of code:

void EnsureTablesAreCreated()
{
  EnsureTablesAreCreatedAsync().Wait();
}

Now we have a small WPF application for initial configuring of our main application. This config app is started as the first app ever on the database and thus becomes the app that creates the database tables for Rebus indirectly through EnsureTablesAreCreated.

Unfortunately WPF + synchronous Wait() result in a deadlock which means our little config app now deadlocks without ever creating the SQL server data tables (since it deadlocks before changes are commited to the database).

mookid8000 commented 6 years ago

Good catch 👍 It is fixed in 5.0.0-b2 which is out in a few minutes