OracleLogicalTransaction not disposed — oracle-tech

    Forum Stats

  • 3,716,136 Users
  • 2,242,961 Discussions
  • 7,845,842 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

OracleLogicalTransaction not disposed

Iskender
Iskender Member Posts: 5
edited January 2020 in ODP.NET

Hello.

I'm using Oracle.ManagedDataAccess version 19.6.0.

Many OracleLogicalTransaction instances created implicitly, they fill freachable queue and wait finalization. I dispose connection, command and reader, but looks like OracleLogicalTransaction created inside library code and never disposed. Moreover they hold reference to connection and prevent it from garbage collection (until OracleLogicalTransaction finalization).

It will be fixed in future versions? Or may be some workaround to dispose OracleLogicalTransaction?

Iskender

Answers

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited December 2019

    Can you provide more details how your OLT instances are being created implicitly? Does it prevent you from calling OLT's Dispose method?

  • Iskender
    Iskender Member Posts: 5
    edited January 2020

    I don't create OLT instances in my code, just see it in dump. My use case is just like

    using (var connection = ...) {

         using (var command = ...) {

              using (var reader = ...) {

                   ...

              }

         }

    }

    But when look at finalized objects (in dump or using some tool like PerfView or dotMemory) many OLT instances finalized or wait for finalization.

  • Iskender
    Iskender Member Posts: 5
    edited January 2020

    Program.cs for test. Run (with some correct connection string), collect events with PerfView, there are many OracleLogicalTransaction in GCStats Finalized Object Counts.

    class Program

    {

        const string ConnectionString = "...";

        static void Main(string[] args)

        {

            while (true)

            {

                DBCall();

                GC.Collect();

                Thread.Sleep(100);

            }

        }

        static void DBCall()

        {

            var result = new List<decimal>();

            using (var connection = new OracleConnection(ConnectionString))

            {

                connection.Open();

                using (var command = connection.CreateCommand())

                {

                    command.CommandText = "select 42 from dual";

                    using (var reader = command.ExecuteReader())

                    {

                        while (reader.Read())

                        {

                            result.Add((decimal)reader[0]);

                        }

                    }

                }

            }

            Console.WriteLine($"{DateTime.Now} read {string.Join(", ", result)}");

        }

    }

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited January 2020

    Thanks for the test case. You can only access the OLT objects directly from OracleException objects, which would not be created in this situation/

    I filed bug 30750461 to investigate this issue.

    Iskender
  • Iskender
    Iskender Member Posts: 5
    edited January 2020

    Thank you. I have no access to view this bug, can you please forward final resolution after bug closed?

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited January 2020

    Your organization's My Oracle Support account owner should be able to track this bug on your behalf.

  • Iskender
    Iskender Member Posts: 5
    edited January 2020

    I connect my account with my organization's Support Identifier (request already approved), but still can't view this bug:

    bug_could_not_be_displayed.png

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 2,753 Employee
    edited January 2020

    I forgot to make the bug publicly viewable. Just changed it. You should be able to view it.

    Iskender
Sign In or Register to comment.