Runtime error 216 since ODAC 9.3.9

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cis-wurzen
Posts: 75
Joined: Tue 04 Jan 2005 10:26

Runtime error 216 since ODAC 9.3.9

Post by cis-wurzen » Mon 09 Mar 2015 16:47

Since ODAC 9.3.9 a runtime error 216 can appear when closing an application. I cannot provide a testcase, but describe the problem with your code and expect that you find and fix the issue.

The issue is related to your manual ARC and it crashs in TOCIEnvironment.FreeErrorHandle called from TOCIEnvironment.Release, because Home is invalid. (F)Home or better to say the whole TOCIEnvironment instance is invalid, because it was already destroyed by the call to TOCIEnvironment.ClearOCISvcCtxs within the middle of TOCIEnvironment.Release. ClearOCISvcCtxs calls TOCISvcCtx(FOCISvcCtxs).Release, which calls SetEnvironment(nil), that may decrement the refcounter on the TOCIEnvironment instance it is being called from. The refcount decrease does cause the destruction and so on.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Runtime error 216 since ODAC 9.3.9

Post by AlexP » Tue 10 Mar 2015 07:16

Hello,

We have already fixed a similar problem, please try to reproduce the problem on the latest trila ODAC version 9.4.14 http://www.devart.com/odac/download.html .

cis-wurzen
Posts: 75
Joined: Tue 04 Jan 2005 10:26

Re: Runtime error 216 since ODAC 9.3.9

Post by cis-wurzen » Tue 10 Mar 2015 12:14

I've tested 9.4.14 before my initial post and the description of the issue with your code applies to 9.4.14. However the runtime error 216 symptom exists since 9.3.9, that information might help you even if the code I referred to might be older than 9.3.9, but gets a problem since 9.3.9 due to other changes (critical sections?). Using FastMM in FullDebugMode helps to catch the issue, because freed memory is filled with $80.

Behavior:
- 9.2.5 -> everything okay regarding the shutdown
- 9.2.7 and 9.3.8 -> no runtime error 216 on shutdown, but a memory leak (37 - 52 bytes: TOCISvcCtx x 1)
- 9.3.9 and newer -> runtime error 216 on shutdown


Memory leak details
--------------------------------2015/3/10 12:57:15--------------------------------
A memory block has been leaked. The size is: 52

This block was allocated by thread 0x2BDC, and the stack trace (return addresses) at the time was:
404C16
407CF7
408366
BD3A2A [OraCall.pas][OraCall][OraCall.TOCISvcCtx.Create][6766]
BD1369 [OraCall.pas][OraCall][OraCall.TOracleHome.AllocEnvironment][5855]
C493AD [OraClasses.pas][OraClasses][OraClasses.TOCIConnection.Connect][2774]
B99BBD [DBAccess.pas][DBAccess][DBAccess.TCustomDAConnection.DoConnect][3903]
C95DC3 [Ora.pas][Ora][Ora.TOraSession.DoConnect][2459]
B99FBA [DBAccess.pas][DBAccess][DBAccess.TCustomDAConnection.PerformConnect][4019]
B9CFBE [DBAccess.pas][DBAccess][DBAccess.TCustomDAConnection.SetConnected][4982]
C98415 [Ora.pas][Ora][Ora.TOraSession.SetConnected][2892]

The block is currently used for an object of class: TOCISvcCtx

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Runtime error 216 since ODAC 9.3.9

Post by AlexP » Wed 11 Mar 2015 07:23

We can't reproduce the problem on our test projects and data. Please try to compose a small test application and send it to support*devart*com.

Post Reply