Bug #14988 Prep STMT appears not to be 64bit clean
Submitted: 16 Nov 2005 15:37 Modified: 27 Dec 2005 9:09
Reporter: Thorben Jändling Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.15 OS:Linux (Debian Linux amd64)
Assigned to: CPU Architecture:Any

[16 Nov 2005 15:37] Thorben Jändling
Description:
On migrating my application from a 32bit platform where it works fine
to a 64bit one, I found various problem with mysql.

In this case it is with the C API's prepared statement. The values that appear
in the table are not the ones sent to it. Also the application dies with
various nonsense error messages, most common is:
mysql_stmt_execute(): Incorrect arguments to mysql_stmt_execute

mysql_stmt_execute() is run in a tight loop where its arguments do not change,
only the data the bind array points to does. This happens after an unfixed number
of iterations into the program and is not always the same error message.
(The test case included has yet to give an error, ie it completes, but the values
in the table are still wrong)

I have added printf to look at the pointers and values of the MYSQL_BIND
structure array used and they are fine.

Sometimes mysqld its self seg faults:
Nov  2 13:43:58 heimdall mysqld[14458]: mysqld got signal 11;
(not always, no backtrace in log? let me know if i should have enabled
something)

Installation:
Debian Linux, Etch (except mysql 5.0.15 is from SID) amd64
Linux heimdall 2.6.13-1-em64t-p4-smp #1 SMP Sat Oct 8 13:58:00 CEST 2005 x86_64 GNU/Linux
Quad Xeon 64bit (em64t), 16GB RAM
I have yet to tune mysql to make use of all that ram, its still with default-ish*
config.

*increased open file max to 65535 may need to increase it further but that
appears to be mysql limit, (on both 32bit and 64bit)
(my.cf: open_files_limit        = 131072
 sysctl: fs.file-max = 1578208)

How to repeat:
I have taken my app and edited it in to an example/test case.
The code looks bizare because I have folded things in from other
supporting file of the original, deleted anything not to do with this
code path, and harded coded a lot of stuff (ie removed 'if' and
func calls).

It still behaves fine on 32bit and goes very wrong on 64 bit.

I am sorry the file is so long but format6 is fairly straight
forward to follow, the rest just supports its opperation. I'll
attach it after submit
[16 Nov 2005 15:38] Thorben Jändling
my code stripped down to a stand alone test case

Attachment: mysql-64bit-test.c (text/x-csrc), 27.23 KiB.

[18 Nov 2005 12:43] Thorben Jändling
It seems that this bug is with Debian's MySQL not MySQL its self.
I downloaded the binaries for 5.0.15-standard em64t, and all is
well once more.

I haven't removed the debian install, I just started the community
edition server, so my app is still using the debian libmysqlclient.
This suggest the problem is more specifically in the Debian server
package.

I will file a bug with bugs.debian.org, sorry for any inconvenience.

Thorben
[26 Nov 2005 10:05] Valeriy Kravchuk
Thank you for a problem report and your effforts to find the reason behind it. Can we close this bug report now, as the problem is not in MySQL code itself? Or, may be, you want me to perform more checks? Please, send also the URL of the Debian bug report you created, if any.
[26 Nov 2005 21:03] Thorben Jändling
Hi.

I can tell you where it does or doesn't work, not whats causing the bug.
I does seem that it's an issue with just the debian build so you could
close this. If the trail leads back to a bug in the source I assume I can
just add a comment and reopen this bug?

The bug report I filled with Debian can be found here:
http://bugs.debian.org/339740

I am still looking into this problem I would prefere an install under
the package manager for maintenance reasons. Although at the
moment I am running the community edition server not Debians.

Thank you for taking time to look at this

Thorben
[27 Nov 2005 9:09] Valeriy Kravchuk
Thank you for your comments and URL. I'll put this report in Need Feedback state for you to be able to reopen it any time during next month. Then it will be closed automatically, but I'll keen an eye on it after that too.
[28 Dec 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".