Issue Details (XML | Word | Printable)

Key: DNET-879
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jiri Cincura
Reporter: Yuriy
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
.NET Data provider

connection shutdown

Created: 23/Apr/19 09:13 AM   Updated: 02/May/19 08:50 AM
Component/s: ADO.NET Provider
Affects Version/s: 6.5.0.0
Fix Version/s: 6.7.0.0

Environment: Windows10 , Firebird embedded 3


 Description  « Hide
Server Error in '/' Application.
connection shutdown
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: FirebirdSql.Data.Common.IscException: connection shutdown

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[IscException: connection shutdown]
FirebirdSql.Data.Client.Native.FesServiceManager.ProcessStatusVector(IntPtr[] statusVector) +105
FirebirdSql.Data.Client.Native.FesServiceManager.Attach(ServiceParameterBuffer spb, String dataSource, Int32 port, String service, Byte[] cryptKey) +181
FirebirdSql.Data.Services.FbService.Open() +675

[FbException (0x14000218): connection shutdown]
FirebirdSql.Data.Services.FbService.Open() +1024
FirebirdSql.Data.Services.FbService.QueryService(Byte[] items) +56
FirebirdSql.Data.Services.FbService.ProcessQuery(Byte[] items, Action`2 queryResponseAction) +49
FirebirdSql.Data.Services.FbService.Query(Byte[] items) +142
FirebirdSql.Data.Services.FbServerProperties.GetInfo(Int32 item) +46
FirebirdSql.Data.Services.FbServerProperties.GetString(Int32 item) +9
EntityFramework.Firebird.FbProviderServices.GetDbProviderManifestToken(DbConnection connection) +125

[InvalidOperationException: Could not retrieve storage version.]
EntityFramework.Firebird.FbProviderServices.GetDbProviderManifestToken(DbConnection connection) +240
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +115

[ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +372
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +23

[ProviderIncompatibleException: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.]
System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +100
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +87
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +89
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +63
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +222
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +224
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +884
System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized() +21
System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer) +134
System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml) +128
System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase) +682
System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration) +28
VMS.Core.Infrastructure.Startup.ApplyMigrations() in D:\Projects\vistra-jenkins\Core\VMS\Core\Infrastructure\Start\Startup.cs:60
VMS.Core.Infrastructure.Startup.Configuration(IAppBuilder app) in D:\Projects\vistra-jenkins\Core\VMS\Core\Infrastructure\Start\Startup.cs:35

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
Owin.Loader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder) +93
Owin.Loader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder) +212
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +873
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +51
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +101
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 23/Apr/19 11:48 AM
This error can happen if the native library was shutdown using fb_shutdown.

Jiri Cincura added a comment - 23/Apr/19 06:50 PM
I need some code to replicate it.

Yuriy added a comment - 24/Apr/19 06:53 AM - edited
Error can happend on ASP. MVC application on Firebird embedded 3 database, EF 6.2., Codefirst, which is deployed to IIS.
1. Start application
2. Shutdown IIS.
3. Try to reload application.
Expected result = Actual result = Application is not accesible.
4. Start IIS
5. Try to reload application.
Expected result: Application is run successfully
Actual result: Sometime It throws exception connection shutdown.

Yuriy added a comment - 24/Apr/19 07:42 AM
Sometimes this error occurs if we try to Update-Database with new migration via PM console or by code like this:

private static void ApplyMigrations() {
using (var db = new ApplicationDbContext()) {
var connString = db.Database.Connection.ConnectionString;
if (connString.Contains("ServerType=1")) {
var configurationFirebird = new DbModelFirebird.Migrations.Configuration();
var migrator = new DbMigrator(configurationFirebird);
migrator.Update();
}
else {
var configurationMySql = new DbModelMySql.Migrations.Configuration();
var migrator = new DbMigrator(configurationMySql);
migrator.Update();
}
}
}

I tried to update-database in PM console and got such error. After reloading Visual Studio 2017 database updated well.

Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
System.Data.Entity.Core.ProviderIncompatibleException: An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure. ---> System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.InvalidOperationException: Could not retrieve storage version. ---> FirebirdSql.Data.FirebirdClient.FbException: connection shutdown ---> FirebirdSql.Data.Common.IscException: connection shutdown
   at FirebirdSql.Data.Client.Native.FesServiceManager.ProcessStatusVector(IntPtr[] statusVector)
   at FirebirdSql.Data.Client.Native.FesServiceManager.Attach(ServiceParameterBuffer spb, String dataSource, Int32 port, String service, Byte[] cryptKey)
   at FirebirdSql.Data.Services.FbService.Open()
   --- End of inner exception stack trace ---
   at FirebirdSql.Data.Services.FbService.Open()
   at FirebirdSql.Data.Services.FbService.QueryService(Byte[] items)
   at FirebirdSql.Data.Services.FbService.ProcessQuery(Byte[] items, Action`2 queryResponseAction)
   at FirebirdSql.Data.Services.FbService.Query(Byte[] items)
   at FirebirdSql.Data.Services.FbServerProperties.GetInfo(Int32 item)
   at FirebirdSql.Data.Services.FbServerProperties.GetString(Int32 item)
   at EntityFramework.Firebird.FbProviderServices.GetDbProviderManifestToken(DbConnection connection)
   --- End of inner exception stack trace ---
   at EntityFramework.Firebird.FbProviderServices.GetDbProviderManifestToken(DbConnection connection)
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
   at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
   at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection)
   at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
   at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
   at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
   at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.LazyInternalContext.get_ModelBeingInitialized()
   at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter writer)
   at System.Data.Entity.Utilities.DbContextExtensions.<>c__DisplayClass1.<GetModel>b__0(XmlWriter w)
   at System.Data.Entity.Utilities.DbContextExtensions.GetModel(Action`1 writeXml)
   at System.Data.Entity.Utilities.DbContextExtensions.GetModel(DbContext context)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
   at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.

Jiri Cincura added a comment - 24/Apr/19 07:49 AM
Don't use embedded Firebird inside VS, simple as that. You don't control the loading and unloading.

Yuriy added a comment - 24/Apr/19 08:58 AM
Sometimes such error occurs in production environment as well, if we try to do some operation with database: such as replace database to new one.

Jiri Cincura added a comment - 29/Apr/19 10:12 AM
Feel free to grab this https://teamcity.jetbrains.com/viewQueued.html?itemId=2231294 build and test it.

Yuriy added a comment - 30/Apr/19 09:29 AM
Thank you very much. We tested it and error is gone. Everything works properly.

Yuriy added a comment - 02/May/19 08:50 AM
I am looking forward updated 6.7.0.0 version with this fix in Nuget packages to use it in production :)