Re: crash in DBD::mysql/ statement leak in DBD::mysql

Rainer Weikusat <[email protected]> Mon, 21 May 2007 15:29:46 +0200
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Patrick Galbraith <[email protected]> writes:
> Thanks for the patch! I will test it this week against various
> versions of MySQL.

One problem I know of already is that the error handling in
dbd_st_destroy is b0rked. The logic is inverted and getting at the dbh
the way I tried to does not always work this way. What I currently use
looks like this:

    if (mysql_stmt_close(imp_sth->stmt))
    {
        /*
           Only documented 'known error' is 'server has gone
	   away'. In case of others, the prepared statement
	   will be leaked in the server.
	*/
        PerlIO_printf(DBILOGFP,
	              "DESTROY(%p): mysql_stmt_close failed, error %d (%s).\n",
	              sth, mysql_stmt_errno(imp_sth->stmt),
	              mysql_stmt_error(imp_sth->stmt));
    }

I don't think there is a point in calling do_error with the sth,
because the DESTROY context implies that the (Perl-)program has no longer
a way to access the statement handle (otherwise, destroy wouldn't
have been called).

Information which may be of use: I am using this w/ mysql 5.0.32/
Debian stable and it works there.
 

-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]