|
|||||||||||
|
Safemalloc error in custom storage engine
From: Timothy P Clark <timclark(at)us.ibm.com>
Date: Wed Aug 01 2007 - 10:42:14 EDT Hi, I'm working on developing a custom storage engine, and I'm encountering a strange error that is stumping me. I aplogize for the length of my posting, but I wanted to provide as much info as I could. The initial symptom was this: if I do a "CREATE TABLE mytable (i int) ENGINE=myengine" and then a "SELECT * FROM myengine", my storage engine often receives a SIGSEGV on the SELECT. When I step through the debugger, I see that the code that is causing the SIGSEGV usually appears to come from within the safemalloc sanity checking function while it is trying to print a message about a memory underrun.
Looking at my server log, I discover a large number of safemalloc errors
are being generated, beginning with CREATE TABLE. The SIGSEGV that I was
seeing is only a symptom of earlier corruption. Here are the first two
errors reported for CREATE TABLE:
I'm not sure what those mean, but I first assume I have a memory bug inside my storage engine code. However, I can not find anything that looks suspicious in my code. I go a step further and remove all of my custom code by recopying ha_example.* and only changing identifier names from *example* to *myengine*. (I also remove the DB_TYPE_ assignments in the init func.) In other words, the executable code should be identical to that produced by compiling the example storage engine. When I run the code, however, I'm surprised to find that I'm still receiving the safemalloc errors. The example storage engine does not produce the errors, but my code, which should be identical to the example code, does. Both my engine and the example engine are being loaded dynamically. The next step was to grab a server trace with the --debug option. With both the example storage engine and my "example" storage engine, I started up the server and did a CREATE TABLE. In both cases, the server trace is identical (except for obvious address and engine name differences) up until the following point within ha_create_table. The last line is in my custom engine's trace but not in the example trace. T@1 : | | | | | | | | | >free_table_share T@1 : | | | | | | | | | | enter: table: timclark.i1 T@1 : | | | | | | | | | | >hash_free T@1 : | | | | | | | | | | | enter: hash: 0x2ff1c9b0 T@1 : | | | | | | | | | |destroyed, discovered at '../../../source/mysql-5.1.19 /sql/sql_plugin.cc:917' Given that the source code is identical and that the traced allocations up to this point are identical, what could be causing this safemalloc error in my engine only? Has anyone else encountered this? What are the next steps I need to take to debug this?
Thank you,
-- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals?unsub=lists@pantek.comReceived on Wed Aug 1 11:00:30 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:06:23 EDT |
||||||||||
|
|||||||||||