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

connection shutdown [DNET879] #808

Closed
firebird-automations opened this issue Apr 23, 2019 · 13 comments
Closed

connection shutdown [DNET879] #808

firebird-automations opened this issue Apr 23, 2019 · 13 comments

Comments

@firebird-automations
Copy link

Submitted by: Yuriy (paulesprit)

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

Commits: 9fc62b9

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

This error can happen if the native library was shutdown using fb_shutdown.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

I need some code to replicate it.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: Yuriy (paulesprit)

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.

@firebird-automations
Copy link
Author

Modified by: Yuriy (paulesprit)

environment: Windows10 => Windows10 , Firebird embedded 3

@firebird-automations
Copy link
Author

Commented by: Yuriy (paulesprit)

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.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Don't use embedded Firebird inside VS, simple as that. You don't control the loading and unloading.

@firebird-automations
Copy link
Author

Commented by: Yuriy (paulesprit)

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.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 6.7.0.0 [ 10900 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Feel free to grab this https://teamcity.jetbrains.com/viewQueued.html?itemId=2231294 build and test it.

@firebird-automations
Copy link
Author

Commented by: Yuriy (paulesprit)

Thank you very much. We tested it and error is gone. Everything works properly.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Author

Commented by: Yuriy (paulesprit)

I am looking forward updated 6.7.0.0 version with this fix in Nuget packages to use it in production :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants