Possible issue with 64bit Oracle
Posted: 03.03.2023, 22:26
Hi all.
I use FastMM5's debug mode to check my programs for heap corruption and memory leaks. When I run any queries using the Oracle protocol in 64bit while using FastMM_EnterDebugMode I get a "Memory Corruption Detected" error. Here's the info on the error and the simple console mode program I used to test it. I tested with a few different Oracle Client versions with the same results. This is with the latest Zeos 8 source:
---------------------------
Memory Corruption Detected
---------------------------
A memory block footer has been corrupted.
The block size is 52.
The block was allocated by thread 0x30C0, and the stack trace (return addresses) at the time was:
0000000001028E7A [FastMM5.pas][FastMM5][_ZN7Fastmm532FastMM_DebugGetMem_GetDebugBlockExb][7793]
0000000001028F30 [FastMM5.pas][FastMM5][_ZN7Fastmm518FastMM_DebugGetMemEx][7820]
0000000001009984 [System.pas][System][_ZN6System7_GetMemEx][4923]
000000000149B813 [ZDbcOracleUtils.pas][ZDbcOracleUtils][_ZN15Zdbcoracleutils21AllocateOracleSQLVarsERPNS_9TZSQLVarsEi][1167]
0000000001491899 [ZDbcOracleResultSet.pas][ZDbcOracleResultSet][_ZN19Zdbcoracleresultset17TZOracleResultSet4OpenEv][2411]
0000000001019A7E [System.pas][System][_ZN6System10_IntfClearERNS_15DelphiInterfaceINS_10IInterfaceEEE][39015]
000000000101B7D9 [System.pas][System][_ZN6System17TInterfacedObject14QueryInterfaceERK5_GUIDPv][40152]
0000000001019AB5 [System.pas][System][_ZN6System9_IntfCopyERNS_15DelphiInterfaceINS_10IInterfaceEEES2_][39048]
0000000001019B22 [System.pas][System][_ZN6System9_IntfCastERNS_15DelphiInterfaceINS_10IInterfaceEEES2_RK5_GUID][39128]
000000000148B2A4 [ZDbcOracleResultSet.pas][ZDbcOracleResultSet][_ZN19Zdbcoracleresultset25TZOracleAbstractResultSetC3EN6System15DelphiInterfaceIN9Zdbcintfs11IZStatementEEENS1_13UnicodeStringEPvS7_i][738]
00000000014A6D56 [ZDbcOracleStatement.pas][ZDbcOracleStatement][_ZN19Zdbcoraclestatement25TZAbstractOracleStatement15CreateResultSetEv][437]
00000000012967B6 [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement28PrepareOpenResultSetForReUseEv][3842]
00000000014A77E9 [ZDbcOracleStatement.pas][ZDbcOracleStatement][_ZN19Zdbcoraclestatement25TZAbstractOracleStatement20ExecuteQueryPreparedEv][521]
00000000012983AC [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement7SetWSQLEN6System13UnicodeStringE][4296]
000000000129428C [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement12ExecuteQueryEN6System13UnicodeStringE][3306]
00000000014C445A [ZDbcOracle.pas][ZDbcOracle][_ZN10Zdbcoracle18TZOracleConnection10GetCatalogEv][1025]
000000000100E573 [System.pas][System][_ZN6System8_WriteLnERNS_8TTextRecE][15311]
0000000001688AC5 [ZOraCatTest.dpr][ZOraCatTest][_ZN11Zoracattest14initializationEv][41]
Here's the code:
Note that this doesn't happen in 32bit mode and it also doesn't cause any noticeable issues when run in 64bit without FastMM. It may indicate an issue or perhaps someone more savvy can say that it's "as expected". Thanks!
-Mark
I use FastMM5's debug mode to check my programs for heap corruption and memory leaks. When I run any queries using the Oracle protocol in 64bit while using FastMM_EnterDebugMode I get a "Memory Corruption Detected" error. Here's the info on the error and the simple console mode program I used to test it. I tested with a few different Oracle Client versions with the same results. This is with the latest Zeos 8 source:
---------------------------
Memory Corruption Detected
---------------------------
A memory block footer has been corrupted.
The block size is 52.
The block was allocated by thread 0x30C0, and the stack trace (return addresses) at the time was:
0000000001028E7A [FastMM5.pas][FastMM5][_ZN7Fastmm532FastMM_DebugGetMem_GetDebugBlockExb][7793]
0000000001028F30 [FastMM5.pas][FastMM5][_ZN7Fastmm518FastMM_DebugGetMemEx][7820]
0000000001009984 [System.pas][System][_ZN6System7_GetMemEx][4923]
000000000149B813 [ZDbcOracleUtils.pas][ZDbcOracleUtils][_ZN15Zdbcoracleutils21AllocateOracleSQLVarsERPNS_9TZSQLVarsEi][1167]
0000000001491899 [ZDbcOracleResultSet.pas][ZDbcOracleResultSet][_ZN19Zdbcoracleresultset17TZOracleResultSet4OpenEv][2411]
0000000001019A7E [System.pas][System][_ZN6System10_IntfClearERNS_15DelphiInterfaceINS_10IInterfaceEEE][39015]
000000000101B7D9 [System.pas][System][_ZN6System17TInterfacedObject14QueryInterfaceERK5_GUIDPv][40152]
0000000001019AB5 [System.pas][System][_ZN6System9_IntfCopyERNS_15DelphiInterfaceINS_10IInterfaceEEES2_][39048]
0000000001019B22 [System.pas][System][_ZN6System9_IntfCastERNS_15DelphiInterfaceINS_10IInterfaceEEES2_RK5_GUID][39128]
000000000148B2A4 [ZDbcOracleResultSet.pas][ZDbcOracleResultSet][_ZN19Zdbcoracleresultset25TZOracleAbstractResultSetC3EN6System15DelphiInterfaceIN9Zdbcintfs11IZStatementEEENS1_13UnicodeStringEPvS7_i][738]
00000000014A6D56 [ZDbcOracleStatement.pas][ZDbcOracleStatement][_ZN19Zdbcoraclestatement25TZAbstractOracleStatement15CreateResultSetEv][437]
00000000012967B6 [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement28PrepareOpenResultSetForReUseEv][3842]
00000000014A77E9 [ZDbcOracleStatement.pas][ZDbcOracleStatement][_ZN19Zdbcoraclestatement25TZAbstractOracleStatement20ExecuteQueryPreparedEv][521]
00000000012983AC [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement7SetWSQLEN6System13UnicodeStringE][4296]
000000000129428C [ZDbcStatement.pas][ZDbcStatement][_ZN13Zdbcstatement27TZAbstractPreparedStatement12ExecuteQueryEN6System13UnicodeStringE][3306]
00000000014C445A [ZDbcOracle.pas][ZDbcOracle][_ZN10Zdbcoracle18TZOracleConnection10GetCatalogEv][1025]
000000000100E573 [System.pas][System][_ZN6System8_WriteLnERNS_8TTextRecE][15311]
0000000001688AC5 [ZOraCatTest.dpr][ZOraCatTest][_ZN11Zoracattest14initializationEv][41]
Here's the code:
Code: Select all
program ZOraCatTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses
FastMM5,
System.SysUtils,
System.Diagnostics,
ZConnection;
var
ZConn: TZConnection;
S: String;
begin
{$IFDEF DEBUG}
ReportMemoryLeaksOnShutdown := True;
FastMM_EnterDebugMode;
// FastMM_DebugMode_ScanForCorruptionBeforeEveryOperation := True;
FastMM_MessageBoxEvents := FastMM_MessageBoxEvents + [mmetUnexpectedMemoryLeakSummary];
{$ENDIF}
try
ZConn := TZConnection.Create(nil);
ZConn.Protocol := 'Oracle';
ZConn.User := 'SHARKDB';
ZConn.Password := 'scalesDB4411';
ZConn.Database := 'benthic_tp';
{$IFDEF WIN64}
ZConn.LibraryLocation := 'C:\U\DbClients\Oracle\21.8\64Bit\oci.dll';
{$ELSE}
ZConn.LibraryLocation := 'C:\U\DbClients\Oracle\21.8\32Bit\oci.dll';
{$ENDIF}
ZConn.Connect;
Writeln('Connected!');
Writeln('In 64bit with FastMM5''s Debug mode, this causes a block footer corruption.');
S := ZConn.DbcConnection.GetCatalog;
Writeln(' Connected Schema is: ' + S);
Writeln('');
Writeln('Done');
ZConn.Disconnect;
ZConn.Free;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Writeln('');
Write('Press Enter to quit...');
ReadLn;
{$IFDEF DEBUG}
FastMM_ExitDebugMode;
{$ENDIF}
end.
-Mark