Subject: problem with free/malloc?
To: None <current-users@netbsd.org>
From: Lista de NetBSD current <list11@sepc.edu.mx>
List: current-users
Date: 08/22/2002 13:44:54
Hello

I am not sure if this list is wrong for my post.

Our webmail server is netbsd-1.5.2 Dell4400 xeon 930,
512 MB ram, 2 scsi-iii disks. Apache-1.3.24, php-4.1.2,
mysql-3.23.49. horde/imp 2.0/3.0
Kernel was compiled for me with the
GENERIC file and the difference of "maxusers 64"
(was 32), rtc_offset=360 (was 0)
and comment unnecessary devices.

This server works very fine with this values of httpd.conf:

MinSpareServers 5
MaxSpareServers 16 <- too low for num of users

When I increase MaxSpareServers to 32 and restart apache,
and the load of users begins, I have hundreds of messages
in /var/log/httpd/error_log:

httpd[Thu Aug 22 09:17:02 2002] [notice] child pid 6676 exit signal Segmentation fault (11)
[Thu Aug 22 09:20:32 2002] [notice] child pid 6671 exit signal Segmentation fault (11)
httpd in malloc(): warning: recursive call.
FATAL:  emalloc():  Unable to allocate 2 bytes
httpd in malloc(): warning: recursive call.
FATAL:  emalloc():  Unable to allocate 2 bytes
httpd in free(): warning: chunk is already free.
httpd in free(): warning: chunk is already free. <---- hundreds like this
httpd in free(): warning: chunk is already free.
[Thu Aug 22 09:26:56 2002] [notice] child pid 6673 exit signal Segmentation fault (11)

I modified the startup scripts of apache and mysql with
this line: "ulimit -n 2048"

While the error occurs, users still can work and access mail,
some httpd process born and others dies.

What can I do to see "where is the problem"?

Thanks in advance

Heron Gallegos
--------------------
Additional info (with MaxSpareServers=16):

 PID TT  STAT    TIME COMMAND
   0 ??  DLs  0:00.19 (swapper)
   1 ??  Is   0:00.01 init
   2 ??  DL   0:00.01 (pagedaemon)
   3 ??  DL   0:00.19 (reaper)
   4 ??  DL   0:33.36 (ioflush)
 109 ??  Is   0:00.99 /usr/sbin/syslogd -s
 222 ??  Is   0:00.00 /usr/sbin/sshd
 231 ??  Is   0:00.00 /usr/sbin/inetd -l
 234 ??  Is   0:00.52 /usr/sbin/cron
 251 ??  S    0:08.71 sshd: gallegos@ttyp0
1221 ??  Ss   0:00.69 sendmail: accepting connections
5459 ??  Ss   0:01.49 /usr/pkg/sbin/httpd
6662 ??  I    0:14.06 /usr/pkg/sbin/httpd
6664 ??  I    0:13.23 /usr/pkg/sbin/httpd
6666 ??  I    0:15.39 /usr/pkg/sbin/httpd
6667 ??  I    0:14.29 /usr/pkg/sbin/httpd
6672 ??  I    0:12.81 /usr/pkg/sbin/httpd
6674 ??  I    0:15.43 /usr/pkg/sbin/httpd
6675 ??  I    0:10.84 /usr/pkg/sbin/httpd
6677 ??  I    0:19.25 /usr/pkg/sbin/httpd
6680 ??  I    0:11.79 /usr/pkg/sbin/httpd
6681 ??  I    0:16.88 /usr/pkg/sbin/httpd
6710 ??  I    0:13.19 /usr/pkg/sbin/httpd
6711 ??  S    0:09.48 /usr/pkg/sbin/httpd
6712 ??  S    0:11.54 /usr/pkg/sbin/httpd
6713 ??  S    0:10.37 /usr/pkg/sbin/httpd
6714 ??  I    0:12.21 /usr/pkg/sbin/httpd
6923 ??  I    0:03.24 /usr/pkg/sbin/httpd
 252 p0  Is   0:00.01 -csh
 257 p0  S    0:00.31 -csh
7006 p0  R+   0:00.00 ps -ax
 192 E0- I    0:00.01 /bin/sh /usr/pkg/bin/safe_mysqld --datadir=/var/mysql --pid-file=/var/mysql/dragon.pid
 221 E0- I    0:02.13 /usr/pkg/libexec/mysqld --basedir=/usr/pkg --datadir=/var/mysql --user=mysql --pid-file=/var/mysql/dra
 240 E0  Is+  0:00.00 /usr/libexec/getty Pc ttyE0
 241 E1  Is+  0:00.00 /usr/libexec/getty Pc ttyE1
 242 E2  Is+  0:00.00 /usr/libexec/getty Pc ttyE2
 243 E3  Is+  0:00.00 /usr/libexec/getty Pc ttyE3
-------------------------
NetBSD dragon 1.5.2 NetBSD 1.5.2 (DRAGON) #1: Mon Mar 11 11:00:56 CST 2002     gallegos@dragon:/usr/src/sys/arch/i386/compile/DRAGON i386
-------------------------
load averages:  0.07,  0.09,  0.08                                                                                  13:31:12
33 processes:  32 sleeping, 1 on processor
CPU states:  2.0% user,  0.0% nice,  0.2% system,  0.0% interrupt, 97.8% idle
Memory: 73M Act, 2080K Inact, 296K Wired, 377M Free, 2000M Swp free

  PID USERNAME PRI NICE   SIZE   RES STATE     TIME   WCPU    CPU COMMAND
 6680 nobody     2    0  4744K 6988K sleep     0:12  0.68%  0.68% httpd
 6923 nobody     2    0  4380K 6696K sleep     0:03  0.49%  0.49% httpd
 6662 nobody     2    0  4624K 6968K sleep     0:14  0.15%  0.15% httpd
 6677 nobody     2    0  4520K 6820K sleep     0:19  0.00%  0.00% httpd
 6681 nobody     2    0  4888K 7300K sleep     0:17  0.00%  0.00% httpd
 6666 nobody     2    0  4816K 7216K sleep     0:15  0.00%  0.00% httpd
 6674 nobody     2    0  4736K 7004K sleep     0:15  0.00%  0.00% httpd
 6667 nobody     2    0  4704K 6900K sleep     0:14  0.00%  0.00% httpd
 6664 nobody     2    0  4696K 7136K sleep     0:13  0.00%  0.00% httpd
 6710 nobody     2    0  4444K 6824K sleep     0:13  0.00%  0.00% httpd
 6714 nobody     2    0  4660K 7040K sleep     0:12  0.00%  0.00% httpd
 6672 nobody     2    0  4508K 6748K sleep     0:12  0.00%  0.00% httpd
 6712 nobody     2    0  4552K 6960K sleep     0:11  0.00%  0.00% httpd
 6713 nobody     2    0  4516K 6852K sleep     0:10  0.00%  0.00% httpd
 6675 nobody     2    0  4492K 6828K sleep     0:10  0.00%  0.00% httpd
 6711 nobody     2    0  4548K 6872K sleep     0:09  0.00%  0.00% httpd
------------------
All this packages were compiled in this machine in /usr/pkgsrc:
digest-20010807     Message digest wrapper utility
perl-5.6.1nb7       Practical Extraction and Report Language
libtool-base-1.4.20010614nb8 Generic shared library support script (the script itself)
mysql-client-3.23.49 MySQL, a free SQL database (client)
mysql-server-3.23.49 MySQL, a free SQL database (server)
libmm-1.1.3         Portable abstraction layer for shared memory
gettext-lib-0.10.35nb1 tools for providing messages in different languages, libintl only
gmake-3.79.1        GNU version of 'make' utility
expat-1.95.2        XML parser library written in C
apache-1.3.24       HTTP (Web) server
php-4.1.2           HTML-embedded scripting language
ap-php-4.1.2        Apache module for PHP4
m4-1.4              GNU version of Unix m4 macro-processor
autoconf-2.13       Generates automatic source code configuration scripts
automake-1.4.5nb1   GNU Standards-compliant Makefile generator
php-mysql-4.1.2     PHP4 extension for MySQL databases
imap-uw-2001.1      University of Washington's IMAP, POP2, and POP3 servers
php-gettext-4.1.2   PHP4 extension for gettext support
php-session-4.1.2   PHP4 extension for session-handling
pcre-3.7            Perl Compatible Regular Expressions library
php-pcre-4.1.2      PHP4 extension for Perl-compatible regular expressions
php-xml-4.1.2       PHP4 extension for parsing XML
php-imap-4.1.2      PHP4 extension for IMAP (Internet Mailbox Access Protocol)
php-posix-4.1.2     PHP4 extension for POSIX-like functions
php-zlib-4.1.2      PHP4 extension for zlib compression
php-calendar-4.1.2  PHP4 extension for calendar conversion support
libiconv-1.7nb1     character set conversion library
libxml2-2.4.20      XML parser library for GNOME
php-domxml-4.1.2    PHP4 extension for DOM support
php-ftp-4.1.2       PHP4 extension for FTP access
gettext-m4-0.10.35  autoconf/automake m4 files for GNU NLS library
gettext-0.10.35nb2  tools for providing messages in different languages
freetype-lib-1.3.1  TrueType font rendering engine and library API
jpeg-6b             IJG's jpeg compression utilities
png-1.2.1           Library for manipulating PNG images
xpm-3.4k            The X Pixmap library
x11-links-0.7       shadow tree of links to X11R6 headers and libraries
gd-1.8.4nb1         graphics library for fast PNG creation
php-gd-4.1.2nb2     PHP4 extension for GD graphics library