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

.NET provider should explicitly call fb_shutdown() on application exit when using Firebird Embedded [DNET806] #743

Closed
firebird-automations opened this issue Feb 7, 2018 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

Is related to DNET802

If the apllication exits and there are still connections open using Firebird Embedded, then the exit may produce an access violation (0xc0000005 error). The root cause is that the fbembed.dll/fbclient.dll will call fb_shutdown() itself, but one of the other libraries (eg fbintl.dll) may already have been unloaded.

To prevent this, on exit the .NET provider should explicitly call fb_shutdown for any of the native libries loaded (but especially for embedded).

See also "Crash Firebird 2.5.8 Embedded with Firebird http://Ado.net provider." on Firebird-devel.

Related: DNET802 (cleaning up the connection pool on exit will also prevent the access violation).

Commits: 469bbac

@firebird-automations
Copy link
Author

Commented by: @cincuranet

I suppose the DNET802 will cover that fully, no?

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Maybe, but what I get from the reaction of Vlad is that it would be better to call fb_shutdown explicitly always when the native library has been loaded.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue is related to DNET802 [ DNET802 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 6.5.0.0 [ 10887 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Commented by: fish (fishcodelib)

{
ShutdownHelper.RegisterFbClientShutdown(() => result.fb_shutdown(0, 0)); //This will throw the following error when connecting to Firebird 2.1 and earlier.
}

System.EntryPointNotFoundException
HResult=0x80131523
Message=Unable to find an entry point named 'fb_shutdown' in DLL 'J:\fbembed.dll'.
Source=FB_431220871_Assembly
StackTrace:
at FB_431220871_Class.fb_shutdown(Int32 timeout, Int32 reason)
at FB_431220871_Class.IFbClient.fb_shutdown(Int32 timeout, Int32 reason)

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Yeah I know. Given the 2.1 is not supported by CORE either, I'd like to not bury myself with too much compatibility. Previous versions are still here and working. Yet it doesn't seem to be right, just because of this. Probably just wrapping in in try-catch and ignoring the EntryPointNotFoundException is good enough solution.

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