Failure during migration 2.6 -> 3.1, SQL Timeout

We’re trying to restore our 2.6 backup to a new server and running into a timeout failure and can’t figure out why this is happening.

SQL connection query timeout is the default 600.

-------------------------------------------------------------------------------
Error: Error while executing SQL command: Timeout expired.  The timeout period elapsed prior to completion of the operat
ion or the server is not responding.
The statement has been terminated.
The command being executed was:
UPDATE dbo.[Certificate] SET [Thumbprint] = @Thumbprint, [Name] = @Name,  Json = @Json WHERE Id = @Id
-------------------------------------------------------------------------------
Error while executing SQL command: Timeout expired.  The timeout period elapsed prior to completion of the operation or
the server is not responding.
The statement has been terminated.
The command being executed was:
UPDATE dbo.[Certificate] SET [Thumbprint] = @Thumbprint, [Name] = @Name,  Json = @Json WHERE Id = @Id
System.Exception: Error while executing SQL command: Timeout expired.  The timeout period elapsed prior to completion of
 the operation or the server is not responding.
The statement has been terminated.
The command being executed was:
UPDATE dbo.[Certificate] SET [Thumbprint] = @Thumbprint, [Name] = @Name,  Json = @Json WHERE Id = @Id ---> System.Data.S
qlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server i
s not responding.
The statement has been terminated. ---> System.ComponentModel.Win32Exception: The wait operation timed out
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInA
ction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectio
nLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, B
ulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOption
sString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean
 returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean re
turnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boo
lean sendToPipe, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Octopus.Core.RelationalStorage.RelationalTransaction.Update[TDocument](TDocument instance) in Y:\work\refs\tags\3.
1.2\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 170
   --- End of inner exception stack trace ---
   at Octopus.Core.RelationalStorage.RelationalTransaction.Update[TDocument](TDocument instance) in Y:\work\refs\tags\3.
1.2\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 177
   at Octopus.Migrator.DocumentImporters.ConventionBasedImporter`2.Import(ImportedDocument document, ImportContext conte
xt) in Y:\work\refs\tags\3.1.2\source\Octopus.Migrator\DocumentImporters\ConventionBasedImporter.cs:line 123
   at Octopus.Migrator.ImportProcess.ImportController.ConvertDocuments(ImportContext context) in Y:\work\refs\tags\3.1.2
\source\Octopus.Migrator\ImportProcess\ImportController.cs:line 366
   at Octopus.Migrator.ImportProcess.ImportController.Import(IImportedDocumentSource backup) in Y:\work\refs\tags\3.1.2\
source\Octopus.Migrator\ImportProcess\ImportController.cs:line 102
   at Octopus.Migrator.Commands.MigrateCommand.Start() in Y:\work\refs\tags\3.1.2\source\Octopus.Migrator\Commands\Migra
teCommand.cs:line 84
   at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, IComma
ndRuntime commandRuntime, OptionSet commonOptions) in Y:\work\refs\tags\3.1.2\source\Octopus.Shared\Startup\AbstractComm
and.cs:line 57
   at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in Y:\work\refs\tags\3.1.2\source\Octopus.
Shared\Startup\ConsoleHost.cs:line 72
   at Octopus.Shared.Startup.OctopusProgram.Run() in Y:\work\refs\tags\3.1.2\source\Octopus.Shared\Startup\OctopusProgra
m.cs:line 87

Hi Sean,

That is an odd one. Could you tell us a bit more about how your Octopus and SQL servers are configured? Are you running SQL Express on the same machine or using an Azure SQL database, etc…
Does the Octopus Server work fine on your new 3.1 machine? Can you manually create projects through the UI?

Are you doing the import on the same machine that the Octopus Server is running on?

Does any part of the import succeed or is it just timing out on the first document?

Thanks,
Shane

Sadly we got around without a really good fix. It failed repeatedly at that stage, document import. When we ran with the sql profiler to catch more detail it ran all the way through the migration.

Not too helpful I know.

Hi Sean,

I’m glad to hear the migration eventually worked. Sorry for the complication getting set up with 3.1, I hope you enjoy it. Let me know if you need help with anything else.

Cheers,
Shane

Hi

Just a note to confirm that running SQL Profiler against the instance containing the Octopus database I was importing into while running the Import fixed it for me too after 2 failures without running the profiler.

  • I was upgrading from 2.6.4.951 to 3.1.3
  • OctopusBackup file was 179mb so not too large.
  • SQL Server instance was SQL Server 2014 (12.0.4213.0) running in SQL Serer HA mode with ‘MultiSubNetFailover’ set to true in the Import Wizard Advanced Properties.

Cheers,

Chris