Uploaded image for project: 'NHibernate'
  1. NHibernate
  2. NH-278

OracleDataClientDriver crashes because BatcherImpl disposes cached commands

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: beta-0.8.3
    • Fix Version/s: beta-0.8.4
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Oracle 9i, ODP.net provider

      Description

      When running a batch of commands the BactcherImpl stores already used commands in the IDictionary commands for future use. In the mean time, the CloseQueryCommand get called by the Loader and the cached command get disposed. When the BatcherImpl reuses a command from the commands IDictionary Oracle.DataAccess.dll throws a NullReferenceException. This doesn't seem to affect other drivers. It didn't occur in 0.7 because the CloseQueryCommand didn't do any job.
      Anyway, from the experience we have with the OracleDataClientDriver, it seems that calling Dispose on an OracleCommand doesn't dispose the command unless you have explicitly disposed the command parameters before (might be useful to add that to the CloseQueryCommand)

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            mdoerfler Mike Doerfler added a comment -

            NH-217 , NH-264 , and dev mailing list have been discussing this one. Thanks for letting us know how Oracle handles it.

            OracleData seriously requires the Parameters to be disposed of individually?? How often do people keep parameters hanging around without the command - you've got to be kidding me Oracle.

            Show
            mdoerfler Mike Doerfler added a comment - NH-217 , NH-264 , and dev mailing list have been discussing this one. Thanks for letting us know how Oracle handles it. OracleData seriously requires the Parameters to be disposed of individually?? How often do people keep parameters hanging around without the command - you've got to be kidding me Oracle.
            Hide
            mdoucy1 mathieu doucy added a comment -

            We figured out we add to do something like:

            if ( command != null )
            {
            if (command.Parameters != null)
            {
            foreach ( OracleParameter param in command.Parameters )

            { param.Dispose(); }

            }
            command.Connection = null;
            command.Dispose();
            }

            In order to prevent unreferenced OracleCommands and OracleParameters to stay in memory (causing serious memory leaks on server apps)

            Show
            mdoucy1 mathieu doucy added a comment - We figured out we add to do something like: if ( command != null ) { if (command.Parameters != null) { foreach ( OracleParameter param in command.Parameters ) { param.Dispose(); } } command.Connection = null; command.Dispose(); } In order to prevent unreferenced OracleCommands and OracleParameters to stay in memory (causing serious memory leaks on server apps)

              People

              • Assignee:
                mdoerfler Mike Doerfler
                Reporter:
                mdoucy1 mathieu doucy
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Who's Looking?