Firebird embeded server crashes -------------------------------- Key: CORE-4500 URL: http://tracker.firebirdsql.org/browse/CORE-4500 Project: Firebird Core Issue Type: Bug Components: Engine Affects Versions: 2.5.3, 2.5.2 Update 1, 2.5.2 Environment: OS: Windows Server 2012 Firebird: embeded server V2.5.1.26351 Crashed Application: [My C# Windows Service App (.exe) for .NET 4.0] => [.NET Data Provider (.dll)] => [Firebird Embeded Server (.dll)] Reporter: Y. Numai Priority: Critical
My C# Windows Service Application uses .NET Data Provider and FB Embeded server (fbembed.dll). However, it sometimes crashes when it connects to a firebird database file. ===EventLog(Application) EID 1026=== Exception: System.AccessViolationException Stack: at FB_1236665269_Class.isc_attach_database(IntPtr[], Int16, Byte[], Int32 ByRef, Int16, Byte[]) at FB_1236665269_Class.isc_attach_database(IntPtr[], Int16, Byte[], Int32 ByRef, Int16, Byte[]) at FirebirdSql.Data.Client.Native.FesDatabase.Attach(FirebirdSql.Data.Common.DatabaseParameterBuffer, System.String, Int32, System.String) at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.Connect() at FirebirdSql.Data.FirebirdClient.FbConnectionPool.Create() at FirebirdSql.Data.FirebirdClient.FbConnectionPool.CheckOut() at FirebirdSql.Data.FirebirdClient.FbConnection.Open() ... ==================================== ===EventLog(Application) EID 1000=== Faulting application name: MyApp.exe, version: 1.0.1.0, time stamp: 0x52eb5d90 Faulting module name: fbembed.DLL, version: 2.5.1.26351, time stamp: 0x4e89609d Exception code: 0xc0000005 Fault offset: 0x000000000027963b Faulting process id: 0x450 Faulting application start time: 0x01cf7f979c1b46a3 Faulting application path: C:\Program Files\MyApp\MyApp.exe Faulting module path: C:\Program Files\MyApp\fbembed.DLL ... ==================================== When my app crashed, it created firebird.log as below. ====firebird.log===== ServerName Fri Jun 20 23:51:31 2014 Fatal lock manager error: ISC_map_file failed (reattach shared file), errno: 1224 ===================== I investigated my application crash dump file, and I finally found out that my app has crashed at fwrite() in the method "LockManager::bug()." ====ll.1651-1655 at Firebird-2.5.1.26351-0\src\lock\lock.cpp, ==== if (fd) { fwrite(m_header, 1, m_header->lhb_used, fd); fclose(fd); } ================================================================== I have a hunch that if "LockManager::acquire_shmem()" failed to "attach_shared_file" (l.1149 at lock.cpp), it calls "LockManager::bug()" (l.1150 at lock.cpp). "LockManager::bug()" referes "m_header->lhb_used" as it shows above. However, if "LockManager::attach_shared_file()" fails, m_header will be NULL. ====ll.337-340 at Firebird-2.5.1.26351-0\src\lock\lock.cpp, ==== m_header = (lhb*) ISC_map_file(status, name.c_str(), initialize, this, m_memorySize, &m_shmem); if (!m_header) return false; ================================================================== Therefore, NULL-reference seems to occur at "fwrite(m_header, 1, m_header->lhb_used, fd)." -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel