php4.0.3pl1 mysql 3.23.26-beta repeatable memory leak and core dump
| From: | netbsd alpha | Date: | Sat, 21 Oct 2000 02:11:57 +0000 |
| Subject: | php4.0.3pl1 mysql 3.23.26-beta repeatable memory leak and core dump | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21519@lists.php.net to get a copy of this message | ||
# uname -a
NetBSD ns01 1.5_ALPHA2 NetBSD 1.5_ALPHA2
(ALPHA-$Revision: 1.127.2.2 $) #5: Tue Oct 3 17:37:31
C
DT 2000
tom@ns01:/usr/src/sys/arch/alpha/compile/ns01-new
alpha
MySQL:
Server version 3.23.26-beta-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 5 min 50 sec
Threads: 1 Questions: 863 Slow queries: 0 Opens: 23
Flush tables: 1 Open tables: 17 Queries
per second avg: 2.466
NOTE: this version of MySQL uses the included
MIT-Pthreads implementation which has been patched to
allow for Unix socket. I've emailed Monty about this.
It should appear in the next release of MySQL.
I test this on two different web pages driven by
php4.0.3pl1. On one webpage, it draws mostly text from
mysql db. on the other, in addition to text, it draws
graphic banners (using phpadsnew) from mysqldb. I load
up IE5.5 on my laptop, keep the CTRL-R
(reload/refresh) down for up to a minute.
On the web page that draws mostly text from mysql,
it's fine. However, on the page that also loads
graphic images from mysql, it will fail at about 20-30
seconds. I know this cause I also load up my telnet
window and use "tail -f /var/mysql/log.err" and "tail
-f /var/log/httpd/error_log" files.
From the mysql error log file:
...
pid 10623 (mysqld): unaligned access: va=0x1603078d4
pc=0x120105850 ra=0x120105800 op=ldt
Segmentation fault - core dumped
001020 20:42:54 mysqld restarted
001020 20:42:54 mysqld restarted
/usr/local/install/mysql-3.23.26-beta/libexec/mysqld:
ready for connections
From Apache error_log file (note, the *** i've
replaced for security):
php_mysql.c(515) : Freeing 0x1202D9040 (576 bytes),
script=/usr/local/web/******ucti
on/hosts/******stories.php
./zend_execute.c(1572) : Freeing 0x1204CAEC0 (24
bytes), script=/usr/local/web/minnesota.com/pro
duction/hosts/******stories.php
./zend_execute.c(405) : Freeing 0x1203F8EC0 (12
bytes), script=/usr/local/web/******
uction/hosts/******stories.php
zend_variables.c(126) : Actual location (location was
relayed)
Last leak repeated 2 times
./zend_execute.c(402) : Freeing 0x1203F8E40 (24
bytes), script=/usr/local/web/******
uction/hosts/******stories.php
Last leak repeated 2 times
./zend-scanner.l(1337) : Freeing 0x1203F89C0 (10
bytes), script=/usr/local/web/minnesota.com/pro
duction/hosts/******stories.php
Last leak repeated 20 times
./zend-scanner.l(1250) : Freeing 0x1203F88C0 (5
bytes), script=/usr/local/web/******
uction/hosts/******stories.php
Last leak repeated 47 times
./zend-scanner.l(1258) : Freeing 0x1203F8840 (4
bytes), script=/usr/local/web/******
uction/hosts/******stories.php
Last leak repeated 6 times
zend_compile.c(816) : Freeing 0x1203F83C0 (14 bytes),
script=/usr/local/web/******uc
tion/hosts/******stories.php
zend_variables.c(126) : Actual location (location was
relayed)
zend_opcode.c(237) : Freeing 0x1203D9B40 (12 bytes),
script=/usr/local/web/******uct
ion/hosts/******stories.php
zend_opcode.c(48) : Freeing 0x12039A040 (32768
bytes), script=/usr/local/web/******u
ction/hosts/******stories.php
./zend-scanner.l(1528) : Freeing 0x1203096C0 (2
bytes), script=/usr/local/web/******
uction/hosts/******stories.php
Last leak repeated 29 times
./zend-scanner.l(1266) : Freeing 0x120309640 (4
bytes), script=/usr/local/web/******
Here is the gdb trace of mysql's core dump:
# gdb /usr/local/libexec/mysqld /var/mysql/mysqld.core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General
Public License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "alpha--netbsd"...
Core was generated by `mysqld'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.elf_so...done.
Reading symbols from /usr/lib/libz.so.0...done.
Reading symbols from /usr/lib/libcrypt.so.0...done.
Reading symbols from /usr/lib/libstdc++.so.2...done.
Reading symbols from /usr/lib/libm.so.0...done.
Reading symbols from /usr/lib/libc.so.12...done.
#0 0x1202211e8 in machdep_sys_sigprocmask () at
syscall-template.S:53
syscall-template.S:53: No such file or directory.
(gdb) backtrace
#0 0x1202211e8 in machdep_sys_sigprocmask () at
syscall-template.S:53
warning: Hit heuristic-fence-post without finding
warning: enclosing function for address 0x124dd49d0
This warning occurs if you are debugging a function
without any symbols
(for example, in a stripped executable). In that
case, you may wish to
increase the size of the search with the `set
heuristic-fence-post' command.
Otherwise, you told GDB there was a function where
there isn't one, or
(more likely) you have encountered a bug in GDB.
Current language: auto; currently asm
(gdb)
NOTE: syscall-template.S is from MySQL's MIT-Pthreads
which is a symbolic link to a machdep file for
netbsd1.3.
when mysql crashes, the php scripts reports in the
apache logs:
MySQL Connection Failed: Can't connect to local MySQL
server through socket '/tmp/mysql.sock'
a few seconds later everything is fine cause
"safe_mysqld" started it up automatically again. Also
noted is that i did have that error from mysql saying
that there were too many files open. I edited
safe_mysqld and increased the number of file
descriptors and that error went away.
To summarize, I believe the problem lies in MySQL's
MIT-Pthreads syscall-template.S for NetBSD. However, I
know nothing about assembly language nor the inner
workings of NetBSD to fix it. On the other hand, PHP
shouldn't be leaking memory in situations like this either.
__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/