Issue Details (XML | Word | Printable)

Key: CORE-4500
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Dmitry Yemanov
Reporter: Y. Numai
Votes: 0
Watchers: 5

If you were logged in you would be able to see more operations.
Firebird Core

Firebird crashes after unsuccessful remapping of the lock table's shared memory

Created: 25/Jul/14 10:23 AM   Updated: 23/Sep/15 11:28 AM
Component/s: Engine
Affects Version/s: 2.5.2, 2.5.2 Update 1, 2.5.3
Fix Version/s: 3.0 Beta 1, 2.5.4

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)]

QA Status: Cannot be tested

 Description  « Hide
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
   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:, time stamp: 0x52eb5d90
Faulting module name: fbembed.DLL, version:, 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.

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-\src\lock\lock.cpp, ====
if (fd)
fwrite(m_header, 1, m_header->lhb_used, 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-\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)."

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
There are no subversion log entries for this issue yet.