Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-2358

LP:782269 - xt_xn_init_db() locks are initialized twice, leaking resources

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The loop below is run twice in xt_xn_init_db() . It initialized the same pthread_cond structures each time. It leaks events on Windows (since each pthread_cond contains 3 events that would be created with CreateEvent)

      Moreover, it creates problems (i.e debug exceptions) when mysqld is run under application verifier.

      Problematic code :

      for (u_int i=0; i<XT_XN_NO_OF_SEGMENTS; i++)

      { seg = &db->db_xn_idx[i]; XT_XACT_INIT_LOCK(self, &seg->xs_tab_lock); ... }

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            wlad Vladislav Vaintroub added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            The code is in xaction_xt.cc (xtPublic void xt_xn_init_db(XTThreadPtr self, XTDatabaseHPtr db)

            Show
            wlad Vladislav Vaintroub added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources The code is in xaction_xt.cc (xtPublic void xt_xn_init_db(XTThreadPtr self, XTDatabaseHPtr db)
            Hide
            wlad Vladislav Vaintroub added a comment -

            application verifier stops
            LPexportBug782269_mysqld.exe.221.dat.xml

            Show
            wlad Vladislav Vaintroub added a comment - application verifier stops LPexportBug782269_mysqld.exe.221.dat.xml
            Hide
            wlad Vladislav Vaintroub added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources

            Show
            wlad Vladislav Vaintroub added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources
            Hide
            vladimirkolesnikov Vladimir Kolesnikov added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            Hi, Vladislav

            thanks for the report.

            I was not able to reproduce the problem on MariaDB 5.1/Linux. I also added a simple test which didn't discover any problems. Could this be a MariaDB 5.2-specific problem? I will try MariaDB 5.2/Win7x64 once maria pull completes...

            Do you know if the problem happens because the xt_xn_init_db() called twice or because the loop re-inits the same segment twice?

            Show
            vladimirkolesnikov Vladimir Kolesnikov added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources Hi, Vladislav thanks for the report. I was not able to reproduce the problem on MariaDB 5.1/Linux. I also added a simple test which didn't discover any problems. Could this be a MariaDB 5.2-specific problem? I will try MariaDB 5.2/Win7x64 once maria pull completes... Do you know if the problem happens because the xt_xn_init_db() called twice or because the loop re-inits the same segment twice?
            Hide
            wlad Vladislav Vaintroub added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            I fixed it in maria already.
            to reproduce in your non-maria environment, run pbxt test suite having mysqld.exe registered with application verifier. There are couple of interesting things to find with pbxt (of which at least one is still unreported, IIRC index lookup code touched memory behind malloc()ated range)

            Show
            wlad Vladislav Vaintroub added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources I fixed it in maria already. to reproduce in your non-maria environment, run pbxt test suite having mysqld.exe registered with application verifier. There are couple of interesting things to find with pbxt (of which at least one is still unreported, IIRC index lookup code touched memory behind malloc()ated range)
            Hide
            wlad Vladislav Vaintroub added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            Fixed in 5.2.7

            Show
            wlad Vladislav Vaintroub added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources Fixed in 5.2.7
            Hide
            vladimirkolesnikov Vladimir Kolesnikov added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            Did you fix any other PBXT bugs in MariaDB branch? If so then could you please mark them in launchpad, so I could merge them to PBXT trunk.

            Show
            vladimirkolesnikov Vladimir Kolesnikov added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources Did you fix any other PBXT bugs in MariaDB branch? If so then could you please mark them in launchpad, so I could merge them to PBXT trunk.
            Hide
            wlad Vladislav Vaintroub added a comment -

            Re: xt_xn_init_db() locks are initialized twice, leaking resources
            Yes, I fixed couple of PBXT bugs. I marked them in LP

            Show
            wlad Vladislav Vaintroub added a comment - Re: xt_xn_init_db() locks are initialized twice, leaking resources Yes, I fixed couple of PBXT bugs. I marked them in LP
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 782269

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 782269

              People

              • Assignee:
                wlad Vladislav Vaintroub
                Reporter:
                wlad Vladislav Vaintroub
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: