Bug #21543 5.0.24 breaks ABI compatibility for python bindings: InterfaceError on connect
Submitted: 9 Aug 2006 15:46 Modified: 28 Aug 2006 18:35
Reporter: Cristian Gafton Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.24 OS:Linux (Linux)
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: InterfaceError, MySQLdb, python

[9 Aug 2006 15:46] Cristian Gafton
When upgrading the client libraries from 5.0.22 to 5.0.24, the python bindings stop working and error out on connect with an InterfaceError exception:

Traceback (most recent call last):
  File "./test.py", line 8, in ?
    cu.execute("show tables")
  File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 137, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.InterfaceError: (0, '')

This is happening when talking to a server version running a previous version of the mysql server (for example, 5.0.22)

How to repeat:
- get the mysql-python bindings from http://sourceforge.net/projects/mysql-python
- compile against 5.0.22 client libraries
- use the following test script to test connectivity against a 5.0.22 server:

import MySQLdb as mysql
db = mysql.connect(user = "root", db = "mysql", host = "localhost")
cu = db.cursor()
cu.execute("show tables")
print "Got %d tables in mysql db" % (len(cu.fetchall()),)

- now, upgrade the client libraries to 5.0.24
- try the same test script against a 5.0.22 server
- InterfaceError occurs on connect

Suggested fix:
The ABI/protocol changes should be CLEARLY documented in the announcements to make sure that dependent packages (such as python, perl and PHP bindings) get recompiled and updates as well if that is required.

Ideally, a 5.0.x release should not require this.
[10 Aug 2006 14:47] Cristian Gafton
Other binaries are affcted - for example, if I get the mysqlshow binary from a 5.0.22 compile and run it against 5.0.24 client libraries, I get:

sh# ./mysqlshow -u root
./mysqlshow: Cannot list databases: Commands out of sync; you can't run this command now
[10 Aug 2006 21:16] Lars Strojny
Can confirm this bug. Same error message after upgrading, recompiling fixed the issue. OS is Gentoo GNU/Linux.
[15 Aug 2006 17:31] Miguel Solorzano
Thank you for the bug report.
[23 Aug 2006 16:46] Michal Pasternak
I confirm this bug.
[25 Aug 2006 11:54] Valeriy Kravchuk
Bug #21829 was marked as a duplicate of this one.
[25 Aug 2006 14:18] Magnus Blåudd
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
[25 Aug 2006 15:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:


ChangeSet@1.2235, 2006-08-25 11:54:33-04:00, cmiller@zippy.cornsilk.net +3 -0
  Bug#21543: 5.0.24 breaks ABI compatibility for python bindings: \
  	InterfaceError on connect
  Removed the bool flag from the st_mysql_options struct, since it adds 
  another word in size to the memory size and shifts member memory locations
  down, both of which break binary-interface compatibility.
  Instead, use a flag, 2**30, in the client_options bit-field to represent
  that the client should check the SSL certificate of the server.
[25 Aug 2006 16:08] Chad MILLER
Reviewed my Magnus and Tatjana.  Pushed to 5.0.24a release clone.

Documentors:  5.0.24 introduced an ABI incompatibility, which this patch reverts.  Programs compiled against 2.0.24 are not compatible with any version before 5.0.24 or after-and-including 5.0.24a .
[28 Aug 2006 18:35] Paul Dubois
Noted in 5.0.24a changelog.
[13 Sep 2006 8:51] Timothy Smith
Pushed to 5.1.12; bug was not released in 5.1, so no need to document.