Hi all,

this is the situation: on a 3.9 box (see dmesg at bottom)
with 256MB RAM, I am running a MySQL server, version 5.0.22
as installed from the packages.

Also, php5-core-5.0.5 and php5-mysql-5.0.5p0 are installed for apache
to use. And on top of that, a user is running WordPress (wordpress.org),
a PHP-over-MySQL application (looks like http://stare.cz/~nut/blog/)

What happens is that _certain_ queries generated by the application
make the mysql server SEGV (and restart) like this:


060830 15:15:19       1 Connect     [EMAIL PROTECTED] on 
                      1 Init DB     nut
                      1 Query       SELECT option_value FROM wp_options WHERE 
option_name = 'siteurl'
060830 15:15:20       1 Query       SELECT option_name, option_value FROM 
wp_options WHERE autoload = 'yes'
                      1 Query       SELECT option_value FROM wp_options WHERE 
option_name = 'ec3_num_months' LIMIT 1
                      1 Query       SELECT option_value FROM wp_options WHERE 
option_name = 'ec3_nav_below' LIMIT 1
                      1 Query       SELECT option_value FROM wp_options WHERE 
option_name = 'rewrite_rules' LIMIT 1
                      1 Query       SELECT option_value FROM wp_options WHERE 
option_name = 'rewrite_rules' LIMIT 1
                      1 Query       SELECT * FROM wp_categories
                      1 Query       SELECT DISTINCT(post_id) FROM wp_post2cat 
WHERE category_id=13
                      1 Query       SELECT DISTINCT * FROM wp_posts  LEFT JOIN 
wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id)  WHERE 1=1  AND   0=1    AND 
(post_date_gmt <= '2006-08-30 13:15:59' AND id NOT IN 
(-1,38,39,41,104,110,130,136,140,159,161,162,175,181,182,184,197) ) AND 
(post_status = "publish") AND post_status != "attachment" AND category_id <> 2  
AND category_id <> 3  AND category_id <> 4  AND category_id <> 5  AND 
category_id <> 6  AND category_id <> 12  AND category_id <> 10  AND category_id 
<> 11  AND category_id <> 13  AND category_id <> 14  AND category_id <> 15  AND 
category_id <> 16  AND category_id <> 18  AND category_id <> 19  AND 
category_id <> 20  GROUP BY  wp_posts.ID  ORDER BY post_date DESC LIMIT 0, 10
                      1 Query       SELECT wp_postmeta.Post_ID FROM wp_postmeta 
WHERE meta_key = 'sticky' AND meta_value = '1'
                      1 Query       SELECT DISTINCT * FROM wp_posts  LEFT JOIN 
wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id)  WHERE 1=1  AND 
(post_date_gmt <= '2006-08-30 13:15:59' AND id NOT IN 
(-1,38,39,41,104,110,130,136,140,159,161,162,175,181,182,184,197) ) AND 
(post_status = "publish") AND post_status != "attachment" AND category_id <> 2  
AND category_id <> 3  AND category_id <> 4  AND category_id <> 5  AND 
category_id <> 6  AND category_id <> 12  AND category_id <> 10  AND category_id 
<> 11  AND category_id <> 13  AND category_id <> 14  AND category_id <> 15  AND 
category_id <> 16  AND category_id <> 18  AND category_id <> 19  AND 
category_id <> 20  GROUP BY  wp_posts.ID  ORDER BY  post_date DESC LIMIT 0, 10
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=67108864
read_buffer_size=258048
max_used_connections=1
max_connections=100
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 
141935 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

060830 15:15:20  mysqld restarted
[...]


Now, not that the queries aren't stupid (it's a blogging PHP
application, 'nough said?), but anyway: why does MySQL SIGSEGV?

The relevant (IMHO) piece of /etc/my.cnf says

key_buffer = 64M
table_cache = 128
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
max_allowed_packet = 1M
query_cache_size= 16M
thread_concurrency = 2
thread_cache = 8

When I made all the buffers half, result was the same. Also,
there usually IS 141935K of free memory (for mysql to use).

I wonder what is really happening. Does mysql not have enough memory
(as restricted by my.cnf) to process the query? Am I giving MySQL too
much memory (as specified in my.cnf) so that, on a 256 RAM machine,
it gets killed?

This happens whenever this query is sent to the server; OTOH, various
other PHP/MySQL based applications run on the server without problems.

Why does the system send SIGSEGV to the MySQL server? Because
it violates segmentation, right? So is this MySQL's fault?
Or is it a missconfiguration of my.cnf?

Any hint appreciated.

        Thanks for your time

                Jan



OpenBSD 3.9 (GENERIC) #617: Thu Mar  2 02:26:48 MST 2006
    [EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Celeron ("GenuineIntel" 686-class, 128KB L2 cache) 432 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR
real mem  = 268005376 (261724K)
avail mem = 237555712 (231988K)
using 3297 buffers containing 13504512 bytes (13188K) of memory
mainbus0 (root)
bios0 at mainbus0: AT/286+(a5) BIOS, date 08/17/00, BIOS32 rev. 0 @ 0xfd7a0
pcibios0 at bios0: rev 2.1 @ 0xfd7a0/0x860
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdf30/176 (9 entries)
pcibios0: PCI Interrupt Router at 000:07:0 ("Intel 82371FB ISA" rev 0x00)
pcibios0: PCI bus #1 is the last bus
bios0: ROM list: 0xc0000/0x8000 0xc8000/0x800 0xe0000/0x4000! 0xe4000/0xc000
cpu0 at mainbus0
pci0 at mainbus0 bus 0: configuration mode 1 (no bios)
pchb0 at pci0 dev 0 function 0 "Intel 82443BX AGP" rev 0x03
ppb0 at pci0 dev 1 function 0 "Intel 82443BX AGP" rev 0x03
pci1 at ppb0 bus 1
pcib0 at pci0 dev 7 function 0 "Intel 82371AB PIIX4 ISA" rev 0x02
pciide0 at pci0 dev 7 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 
wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <WDC WD600BB-00CAA1>
wd0: 16-sector PIO, LBA, 57241MB, 117231408 sectors
wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2
atapiscsi0 at pciide0 channel 1 drive 0
scsibus0 at atapiscsi0: 2 targets
cd0 at scsibus0 targ 0 lun 0: <LITEON, CD-ROM LTN403, DL1M> SCSI0 5/cdrom 
removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
uhci0 at pci0 dev 7 function 2 "Intel 82371AB USB" rev 0x01: irq 9
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: Intel UHCI root hub, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
piixpm0 at pci0 dev 7 function 3 "Intel 82371AB Power" rev 0x02: SMI
iic0 at piixpm0
"unknown" at iic0 addr 0x18 not configured
lmenv0 at iic0 addr 0x2d: adm9240 rev 2, starting scan
"unknown" at iic0 addr 0x4e not configured
xl0 at pci0 dev 15 function 0 "3Com 3c905C 100Base-TX" rev 0x74: irq 10, 
address 00:50:da:49:94:74
bmtphy0 at xl0 phy 24: Broadcom 3C905C internal PHY, rev. 6
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
vga0 at isa0 port 0x3b0/48 iomem 0xa0000/131072
wsdisplay0 at vga0 mux 1: console (80x25, vt100 emulation), using wskbd0
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
pcppi0 at isa0 port 0x61
midi0 at pcppi0: <PC speaker>
spkr0 at pcppi0
npx0 at isa0 port 0xf0/16: using exception 16
pccom0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
biomask fbed netmask ffed ttymask ffef
pctr: 686-class user-level performance counters enabled
mtrr: Pentium Pro MTRR support
dkcsum: wd0 matches BIOS drive 0x80
root on wd0a
rootdev=0x0 rrootdev=0x300 rawdev=0x302

Reply via email to