Bug #21829 ABI change in libmyslclient breaks Perl DBD::mysql (has_transaction corrupted)

Submitted: 25 Aug 2006 9:36 Modified: 25 Aug 2006 11:53
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.24 OS:
Assigned to: CPU Architecture:Any

[25 Aug 2006 9:36] Christian Hammers
Description:
Hello

Feel free to merge this with #21543 if it is really the same issue, I wasn't sure about it.

There are several bug reports against the Debian packages that beginning with 5.0.24 Perl programs suddenly die with fatal warnings "Transactions not supported by database" when setting $dbh->{AutoCommit} = 0 although the databases do support transactions via InnoDB.

Niko Tyni <ntyni@iki.fi> now seems to have found the problem and identifies it as an ABI change which would mean that you either have to bump the soname to libmysqlclient.so.16 or *immediately* revert this change!!!

-christian-

------ 
Please note, that his bug numbers refers to http://bugs.debian.org/ and
not MySQL bug numbers.
------       

Hi,

this bug (#384047) is also at least #384221 (libdbd-mysql-perl) and
#383700 (request-tracker3.4).

I believe the problem is an incompatible ABI change in
libmysqlclient.15.so with version 5.0.24. 

This addition in struct st_mysql_options:

--- mysql-dfsg-5.0-5.0.22/include/mysql.h	2006-05-25 11:56:42.000000000 +0300
+++ mysql-dfsg-5.0-5.0.24/include/mysql.h	2006-07-27 21:52:03.000000000 +0300
@@ -164,6 +164,7 @@
   char *ssl_ca;					/* PEM CA file */
   char *ssl_capath;				/* PEM directory of CA-s? */
   char *ssl_cipher;				/* cipher to use */
+  my_bool ssl_verify_server_cert;		/* if to verify server cert */
   char *shared_memory_base_name;
   unsigned long max_allowed_packet;
   my_bool use_ssl;				/* if to use SSL or not */

causes the size of st_mysql_options to grow. This also affects the MYSQL
struct, since it contains st_mysql_options.

Now, libdbd-mysql-perl has this in dbdimp.h:

struct imp_dbh_st {
    dbih_dbc_t com;         /*  MUST be first element in structure   */

    MYSQL mysql;
    int has_transactions;   /*  boolean indicating support for
                             *  transactions, currently always
                             *  TRUE for MySQL and always FALSE
                             *  for mSQL.
                             */
[...]

so the grown MYSQL struct overlaps with has_transactions.

This hits libdbd-mysql-perl 3.006-1, which is currently compiled
against libmysqlclient15off-dev 5.0.22-x (with x depending on
the architecture). When run with libmysqlclient15off 5.0.24-1,
has_transactions gets reset to 0 and the result is 'Transactions not
supported by database'. Recompiling libdbd-mysql-perl helps, as the API
has not changed in an incompatible way.

In my understanding, the right fix is to bump the soname or to revert
the struct st_mysql_options change.

How to repeat:
#!/usr/bin/perl
use DBI;
$dbh = DBI->connect("DBI:mysql:localhost");
$dbh->{'AutoCommit'} = 0;

Suggested fix:
Revert ABI change!
[25 Aug 2006 11:53] Valeriy Kravchuk
Thank you for a bug report. I'll mark it a duplicate of bug #21543 (same structure member addition is a possible reason), already verified and marked as showstopper. Should be fixed soon.
[25 Aug 2006 14:20] Magnus BlÄudd
This info is copied from bug#21543, just for info

"Suggested solution is to remove the "ssl_verify_server_cert" variable from the
st_mysql_options struct. Then use one bit in the client_flag as placeholder for
this information.

As the client_flag already is used for another "client side only" functionality
in CLIENT_REMEMBER_OPTIONS this should work.

The new bit should be modified using the CLIENT_SSL_VERIFY_SERVER_CERT mask
defeined as
#define CLIENT_SSL_VERIFY_SERVER_CERT (((ulong) 1) << 30)
in include/mysql_com.h

The library version will after this modification be left at .15"

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.