dotnet / SqlClient

Microsoft.Data.SqlClient provides database connectivity to SQL Server for .NET applications.
MIT License
842 stars 280 forks source link

EF6 add-migration error "The specified network name is no longer available" when NIC has jumbo frames enabled #169

Closed gt1485a closed 4 years ago

gt1485a commented 5 years ago

EFTools add-migration failed in the package management console with the error below. I know this isn't a bug but wanted to document it somewhere for anyone else encountering this issue. Maybe throw warning if IPv4InterfaceProperties.Mtu > 1514? Disabling jumbo frames(MTU = 1514) fixes this error.

PM> add-migration scram2 -projectname EIVision -connectionStringName EiVisionData -verbose E:\Documents\Visual Studio 2010\Projects\3965 SCRAM\Universal Vision 9.3SR1\packages\EntityFramework.6.3.0-preview8-19405-04\tools\net45\win-x86\ef6.exe migrations add scram2 --json --connection-string-name EiVisionData --verbose --no-color --prefix-output --assembly "E:\Documents\Visual Studio 2010\Projects\3965 SCRAM\Universal Vision 9.3SR1\EIVision\bin\x86\TempDebug\EIVision.dll" --project-dir "E:\Documents\Visual Studio 2010\Projects\3965 SCRAM\Universal Vision 9.3SR1\EIVision\" --language C# --root-namespace Electroimpact.Vision --config "E:\Documents\Visual Studio 2010\Projects\3965 SCRAM\Universal Vision 9.3SR1\StandaloneServiceHost\App.config" System.Data.Entity.Infrastructure.RetryLimitExceededException: Maximum number of retries (5) exceeded while executing database operations with 'SqlAzureExecutionStrategy'. See inner exception for the most recent failure. ---> System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) ---> System.ComponentModel.Win32Exception: The specified network name is no longer available --- End of inner exception stack trace --- at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c.b6_0(DbCommand t, DbCommandInterceptionContext1 c) at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) --- End of inner exception stack trace --- at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues) at System.Data.Entity.Core.Objects.ObjectQuery1.<>c__DisplayClass41_0.b1() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectQuery1.<>cDisplayClass41_0.b0() at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func1 operation) --- End of inner exception stack trace --- at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func1 operation) at System.Data.Entity.Core.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) at System.Data.Entity.Core.Objects.ObjectQuery1.b31_0() at System.Data.Entity.Internal.LazyEnumerator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at System.Data.Entity.Migrations.History.HistoryRepository.GetPendingMigrations(IEnumerable1 localMigrations) at System.Data.Entity.Migrations.DbMigrator.GetPendingMigrations() at System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName, String namespace, Boolean ignoreChanges) at System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String migrationName, Boolean ignoreChanges) at System.Data.Entity.Infrastructure.Design.Executor.ScaffoldInternal(String name, DbConnectionInfo connectionInfo, String migrationsConfigurationName, Boolean ignoreChanges) at System.Data.Entity.Infrastructure.Design.Executor.Scaffold.<>cDisplayClass0_0.<.ctor>b0() at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.<>cDisplayClass4_01.b__0() at System.Data.Entity.Infrastructure.Design.Executor.OperationBase.Execute(Action action) Maximum number of retries (5) exceeded while executing database operations with 'SqlAzureExecutionStrategy'. See inner exception for the most recent failure.

Steps to reproduce Enable MTU>1514 on NIC execute add-migration in PMC

Further technical details EF version: 6.1.3,6.2,6.3-preview8 Database Provider: EntityFramework.SqlServer Operating system:Windows 10 IDE: Visual Studio 2017 15.9.11

cheenamalhotra commented 4 years ago

Hi @gt1485a

Since this is not a bug, would it be fair to close the issue?

gt1485a commented 4 years ago

Yes. Is there a better place to document issues like this so others can benefit from my experience?

thanks

cheenamalhotra commented 4 years ago

You can always open an issue and provide mitigations in future, we will publish useful info to official documentations. 👍