Bug #32873 Semaphore object left open after database handle closes in Perl::DBD on windows
Submitted: 30 Nov 2007 11:53 Modified: 20 Feb 2013 22:21
Reporter: Martin GK Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:5.0.45 (DBD::mysql 3.0002) OS:Windows (XP SP2)
Assigned to: CPU Architecture:Any
Tags: dbd, fork, perl, Semaphore, threads, windows

[30 Nov 2007 11:53] Martin GK
Description:
I have a basic FTP server perl application that works on all perl platforms, logging to a MySQL database. When I get an incoming connection, I use the perl fork mechanism to fork a process to handle that connection, and it opens its own database handle for the duration of that forked process. However, under windows, when the database handle is closed and destroyed, a single semaphore handle is left open, and after multiple connections these build up. The simple program attached (well, as simple as I can make it).

I am using perl 5.8.8 (ActiveState), DBI 1.601, DBD::mysql 3.0002, and MySQL 5.0.45

How to repeat:
Put the attached file on a windows machine with perl on it, change the parameters in the get_db_connection function to point at any MySQL database, run the program and monitor it with something like Process Explorer. You'll see the number of handles taken by the process increase by one for each fork, and never clear down until the main process is stopped.
[30 Nov 2007 11:54] Martin GK
Test perl script to recreate problem

Attachment: testhandles6.pl (text/x-perl), 2.39 KiB.

[30 Nov 2007 12:25] Sveta Smirnova
Thank you for the report.

I can not repeat described behaviour with current DBD-mysql-4.005 Please upgrade, try it and if you still can repeat the problem feel free to reopen the report.
[30 Nov 2007 12:51] Martin GK
Have upgraded to most recent modules on CPAN - now DBI 1.601, DBD::MySQL 4.005. I have confirmed that the problem still exists.
[27 Aug 2008 10:10] Sveta Smirnova
Thank you for the feedback.

Verified as described with ActivePerl. With Cygwin bug is not repeatable.
[20 Feb 2013 22:21] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

Since this is repeatable with ActivePerl only there is a sense to open bug at Active Perl also.