Bug #43458 Invalid address alignment bus error in 'free_root' on 64 bit Solaris 10 app
Submitted: 6 Mar 2009 15:24 Modified: 11 Apr 2009 8:06
Reporter: Prashant Kabra Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S1 (Critical)
Version:5.1.31 OS:Solaris (Solaris 10)
Assigned to: CPU Architecture:Any

[6 Mar 2009 15:24] Prashant Kabra
Description:
I am accessing the 64 bit mysql client library on Solaris 10. 32-bit version of the application works fine with 32-bit mysql installation, but with 64-bit build of my application and 64-bit mysql, I get a bus error in the free_root function (in my_alloc.c) apparently due to "Invalid address alignment".

It seems to be due to the differences between 64 bit and 32 bit memory. I have tried the binary mysql downloads as well as building them on my own from the source. MYSQL server seems to be running fine as I was able to do all operations on it error-free as before. The issue is therefore seen only when using the client library.

How to repeat:
I am not sure how to repeat it without using my application. Any suggestions would be helpful. Please see private comments.
[6 Mar 2009 19:07] Prashant Kabra
I was able to get the stack trace:

=>[1] free_root(root = 0x118e766c0, MyFlags = 0), line 347 in "my_alloc.c"
  [2] free_rows(cur = 0x118e766b0), line 737 in "client.c"
  [3] mysql_free_result(result = 0x118e7cf30), line 955 in "client.c"
  [4] Connection::GetGateNameFromInstName(this = 0xffffffff6cd739c8, instname = CLASS, gatename = CLASS), line 510 in "connect.C"

Line 347 is:     old=next; next= next->next ;
(old and next are declared as: reg1 USED_MEM *next,*old;)
[10 Mar 2009 18:40] Sveta Smirnova
Thank you for the report.

I assume you wrote some C application which crashes. Could you please provide its code or, better, minimal test case problem is repeatable with.
[10 Mar 2009 20:07] Sveta Smirnova
Thank you for the feedback.

Could you also please provide class with main function so we can guess sequence of calls.
[10 Mar 2009 21:45] Sveta Smirnova
Thank you for the feedback.

There is no Net and Wire definition in the files provided, but Connection::GetGateNameFromInstName uses it. Please provide files corresponding.
[11 Mar 2009 8:06] Sveta Smirnova
Thank you for the feedback.

In the initial reply you provided backtrace:

=>[1] free_root(root = 0x118e766c0, MyFlags = 0), line 347 in "my_alloc.c"
  [2] free_rows(cur = 0x118e766b0), line 737 in "client.c"
  [3] mysql_free_result(result = 0x118e7cf30), line 955 in "client.c"
  [4] Connection::GetGateNameFromInstName(this = 0xffffffff6cd739c8, instname = CLASS,
gatename = CLASS), line 510 in "connect.C"

But I can not call Connection::GetGateNameFromInstName with 3 source files provided: there are not definition of classes Net and Wire there, so I have to comment definition of Connection::GetGateNameFromInstName to get the program to be compiled.

As you have all sources at your side this is expected what you can compile successfully, but at the same time this can be expected what you don't get error with small test case. So we need complete test case from you. Please check on your side if you can compile if sources are isolated before post.

Regarding to version 3.23.49. Since this version a lot of changes were made. Including changes in C API. So this is not the case "same program worked on 32-bit, but does not work on 64-bit". Please try version 5.1.32 on 32-bit machine also.
[11 Mar 2009 8:29] Sveta Smirnova
I am sorry: missed files attached.

Currently test compiles, but I get many "Table doesn't exist" errors. Please provide SHOW CREATE TABLE for necessary tables also.
[11 Apr 2009 23: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".