Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: interrupting a daemon

by lhoward (Vicar)
on Oct 23, 2004 at 16:00 UTC ( #401853=note: print w/replies, xml ) Need Help??

in reply to interrupting a daemon

MySQL (and a lot of other back ends) will probably do the right thing if you just let the connection die, but its always best to put in a handler and close things up nicely. L

Replies are listed 'Best First'.
Re^2: interrupting a daemon
by tachyon (Chancellor) on Oct 23, 2004 at 22:15 UTC

    By default MySQL will *do the right thing* very slowly. It will actually close an inactive connection after 8 hours. Given that by default there are only 100 connections available it is quite easy to use them all up if you do not do a clean disconnect. You set the values in my.cnf BTW.

    [mysqld] set-variable=wait_timeout=28800 set-variable=max_connections=100

    Cleanup is simple. All you need is an END block, ideally placed immediately after the connect (so you know it is there).

    my $dbh = DBI->connect...... END{ $dbh->disconnect() if $dbh }



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://401853]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2018-03-20 21:33 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (259 votes). Check out past polls.