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

Error trying to release Evolve lock #247

Open
CanIGetaPR opened this issue Nov 20, 2021 · 1 comment
Open

Error trying to release Evolve lock #247

CanIGetaPR opened this issue Nov 20, 2021 · 1 comment

Comments

@CanIGetaPR
Copy link

Evolve C# Library 3.0.0 from nuget
MySQL InnoDB database.
.NET 5

Issue started when I tried adding migrations. Last time I had successful migrations was in 2019. I've upgraded .NET since then. My Evolve was version 2.4.x and I just tried upgrading to 3.0.0 to fix these problems doing migrations. I tried adding the CommandTimeout config just now in case it's timing out. No luck to 3.0.0 or CommandTimeout.

info: Evolve[0]
      Executing Migrate...
info: Evolve[0]
      Evolve initialized.
info: Evolve[0]
      Metadata validated.
info: Evolve[0]
      Error trying to release Evolve lock.
crit: Evolve[0]
      Database migration failed.
Application startup exception: System.InvalidOperationException: Connection must be valid and open to rollback transaction
   at MySql.Data.MySqlClient.MySqlTransaction.Rollback()
   at Evolve.Connection.WrappedConnection.Rollback()
   at Evolve.WrappedConnectionEx.TryRollback(WrappedConnection wrappedConnection)
   at Evolve.Evolve.ExecuteMigration(MigrationScript migration, DatabaseHelper db)
   at Evolve.Evolve.ExecuteAllMigration(DatabaseHelper db)
   at Evolve.Evolve.<InternalMigrate>g__Migrate|135_0(<>c__DisplayClass135_0& )
   at Evolve.Evolve.InternalMigrate(DatabaseHelper db)
   at Evolve.Evolve.<Migrate>b__134_0(DatabaseHelper db)
   at Evolve.Evolve.InternalExecuteCommand(Action`1 commandAction)
   at Evolve.Evolve.Migrate()
conn.ConnectionString = "server=" + host + ";uid=" + user + ";password=" + pass + ";database=" + database + ";";
                var evolve = new Evolve.Evolve(conn, msg => _logger.LogInformation(msg))
                {
                    Locations = new[] { "sql/" },
                    IsEraseDisabled = true,
                    CommandTimeout = 60,
                };

                evolve.Migrate();

Migration

ALTER TABLE `table` ADD COLUMN `column` INT NOT NULL;
@CanIGetaPR
Copy link
Author

It's possible it was timing out, what's the default connection timeout ? documentation provides no value. I set to 600 this time and my next migration took 55 seconds so perhaps it's timeout indeed. Im sure the logging could be improved to state timeout was breached.

I had to manually approve this migration and skip it to get to my next migration so I couldnt test a higher value for timeout.

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

1 participant