Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

DBI connection creates zombie process

by prashantktyagi (Scribe)
on Sep 06, 2012 at 09:32 UTC ( #992043=perlquestion: print w/replies, xml ) Need Help??
prashantktyagi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am making db connection to sql server using dbi proxy.I have one window service(build using perlsvc) written in perl bundled dbiproxy.exe and myserver.exe.

myserver.exe return a available port when client make INET connection.
my $sock = new IO::Socket::INET( PeerAddr => $server, PeerPort => 9000, Proto => 'tcp', );
myserver.exe checks port used and return a port. after that db connection is made from DBI.
my $dsn = "DBI:Proxy:hostname=$server;port=$port;dsn=DBI:ODBC:" . $sel +f->get_db_name(); $dbh = DBI->connect( $dsn, $self->get_db_user(), $self->get_db_password(), { RaiseError => 1, PrintError => 0 } );
After all db operation we close $dbh handle. Here it should kill dbiproxy.exe running on server. But in some case or may be when too much or parallel connection is made, some zombie process created even after closing DBI connection. This cause on server side that dbiproxy.exe hold a port that should be free.
when reserved port (9000-9100) hold by these process. It failed to get a port.
How I can kill these zombie process. I have tried wmic and tasklist command to get the process status but no luck from it.
Guide me and if need more info let me know.

updates

I did some investigation and found out dbiproxy.exe created folders inside windows directory. like
C:\WINDOWS\TEMP\pdk-SYSTEM-$PID\dbiproxy.exe

I did wmic query to check the list of zombie process and deleted process and after that folder related to these process too.


It seems like now not every process is getting finished as a zombie.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://992043]
Approved by marto
help
Chatterbox?
[perldigious]: Quick question, is undef %hash a recommended/good way to delete an entire hash structure from memory? Or sould I be doing it some other way?
[1nickt]: The best way is to scope it tightly so it just goes away when you are finished with it.
[perldigious]: but... but... perldigious is the unvirtuous kind of lazy in this case. :-)
[perldigious]: Just kidding. Thanks 1nickt, I'll go ahead and do it the right way. An extra set of brackets and a little extra indentation isn't too much to ask.
[karlgoethebier]: perldigious: perhaps a block if you are paranoid ;-)
[choroba]: but undef %hash and %hash = () both work, too, but the first one keeps the memory allocated, while the latter makes it available for other parts of the program.
[choroba]: iirc

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2017-07-21 19:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (335 votes). Check out past polls.