[MDEV-2358] LP:782269 - xt_xn_init_db() locks are initialized twice, leaking resources Created: 2011-05-13  Updated: 2015-02-02  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug782269.xml     XML File LPexportBug782269_mysqld.exe.221.dat.xml    

 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); ... }

 Comments   
Comment by Vladislav Vaintroub [ 2011-05-13 ]

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)

Comment by Vladislav Vaintroub [ 2011-05-13 ]

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

Comment by Vladislav Vaintroub [ 2011-05-13 ]

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

Comment by Vladimir Kolesnikov (Inactive) [ 2011-06-14 ]

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?

Comment by Vladislav Vaintroub [ 2011-06-14 ]

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)

Comment by Vladislav Vaintroub [ 2011-06-14 ]

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

Comment by Vladimir Kolesnikov (Inactive) [ 2011-06-14 ]

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.

Comment by Vladislav Vaintroub [ 2011-06-14 ]

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

Comment by Rasmus Johansson (Inactive) [ 2011-06-15 ]

Launchpad bug id: 782269

Generated at Thu Feb 08 06:41:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.