Re: Safemalloc error in custom storage engine
Thanks for your help, Guilhem. My responses are near the bottom.
Guilhem Bichot <guilhem@mysql.com> wrote on 08/01/2007 03:23:17 PM:
> Hello, > > On Wed, Aug 01, 2007 at 02:21:42PM -0500, Timothy P Clark wrote: > > Guilhem Bichot <guilhem@mysql.com> wrote on 08/01/2007 10:25:39 AM: > > > > > Hello, > > > > > > On Wed, Aug 01, 2007 at 09:42:14AM -0500, Timothy P Clark wrote: > > > > 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. > > > <cut> > > > > > > > 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? > > > > > > Are the compilation (compiling, linking etc) commands exactly > > > identical between "example" and your engine? You could just attach
the
> > > output of "cd storage/<engine>; make clean; make" for "example" and > > > for your engine, here. > > > > That's a good question. I hadn't thought about linking differences. The > > make commands are in fact different, because I was still linking to a > > module and a couple of libraries that were needed before I went back to
the
> > base example code. In fact, I've narrowed it down to the following line
in
> > my Makefile: > > ha_myengine_la_LIBADD = ... -L$(top_builddir)/mysys/ -lmysys > > > > If I remove the linkage to the mysys library, all is well. However, I > > originally added this linkage for a reason. I was using my_malloc for > > memory allocations (as suggested in the MySQL Internals Coding
Guidelines),
> > and my .so refused to load because it couldn't resolve to _mymalloc.
Seeing
> > that _mymalloc was defined in libmysys.a, I figured that the best way
to
> > get around that problem was to link my storage engine to that library. > > ok, this is the issue. > > > Was this the wrong thing to do? Are there other pluggable SEs using > > my_malloc? I'm still not sure that I understand why this is causing
heap
> > corruption (or whatever safemalloc is complaining about), but I suppose
I
> > can go back to using standard malloc for now. > > safemalloc is a library we use to detect wrong memory usage (memory > leaks for example). > If you use my_malloc, you have to link with libmysys, true, it's where > my_malloc is. Depending on how it was built (compiler flags), > libmysys' my_malloc() internally uses safemalloc or plain malloc(). > But the problem is that your engine and libmysys must > have the same characteristics: they must either both use safemalloc or
both
> not, or there is an "impedance mismatch", maybe what you are > seeing. > Can you please paste here the "configure" command-line which was used > in the build of the mysql server source tree which includes libmysys? > If you don't remember it, search for CONF_COMMAND in config.log. > With that, we should be able to find proper compiler flags for your > engine.
CONF_COMMAND='../../source/mysql-5.1.19/configure
'--prefix=/gsa/rchgsa/home/t/i/timclark/install/mysql-5.1.19'
'--enable-thread-safe-client' '--enable-local-infile' '--with-debug=full'
'--build=powerpc-ibm-aix5.3.0.0' '--host=powerpc-ibm-aix5.3.0.0'
'--with-machine-type=power' '--with-named-z-libs=no' '--with-pic'
'--with-client-ldflags=-static' '--with-mysqld-ldflags=-static'
'--with-zlib-dir=bundled' '--with-big-tables' '--with-libedit'
'--with-archive-storage-engine' '--with-blackhole-storage-engine'
'--with-example-storage-engine' '--with-federated-storage-engine'
'--with-csv-storage-engine' '--with-extra-charsets=complex'
'--with-mysqld-ldflags=-Wl,-bE:mysqld.exp' 'CC=xlc_r -ma -qstrict
-qmaxmem=8192 -qfullpath -qdbxextra -qldbl128 -qalign=natural' 'CPPFLAGS='
'CXXFLAGS=' 'CXX=xlC_r -ma -qstrict -qmaxmem=8192 -qfullpath -qdbxextra
-qldbl128 -qalign=natural' 'LDFLAGS=-Wl,-brtl -Wl,-bexpall'
'build_alias=powerpc-ibm-aix5.3.0.0' 'host_alias=powerpc-ibm-aix5.3.0.0''
> I know that PBXT faces similar issues: > http://pbxt.blogspot.com/ > "Both MYSQL and PBXT must be compiled with the same value for the > --with-debug switch (on/off/full). If not, the plug-in will not load."
That makes sense, but I'm sure that the same configure file produced
Makefiles for both my storage engine and the rest of the mysql build. As
well, all of the Makefiles have CFLAGS and CXXFLAGS that include
-DSAFEMALLOC
Tim Clark
--
MySQL Internals Mailing List
For list archives:
http://lists.mysql.com/internals
To unsubscribe:
http://lists.mysql.com/internals?unsub=lists@pantek.com
Received on Wed Aug 1 17:15:44 2007
This archive was generated by hypermail 2.1.8
: Thu Aug 09 2007 - 19:06:23 EDT
|