| Bug #30527 | malloc causes mysqld rebooting with memlock | ||
|---|---|---|---|
| Submitted: | 21 Aug 2007 2:49 | Modified: | 27 Aug 2007 5:10 |
| Reporter: | li david | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0.45 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | memlock, mysqld, reboot | ||
[21 Aug 2007 11:39]
Hartmut Holzgraefe
It was most likely killed by the Linux OOM (Out-Of-Memory) kill mechanism. Please check your machines syslog file for OOM log messages. If you see OOM kill messages in the syslog then this is an operating system memory allocation issue and not a MySQL bug.
[23 Aug 2007 1:15]
li david
yes. oom occur in syslog.
[27 Aug 2007 4:59]
Valeriy Kravchuk
So, this problem was not a result of bug in MySQL's code.
[27 Aug 2007 5:10]
li david
yes. thx you!

Description: there are 1G physical memory and 1G swap disk on pc server which is running in fedora 6(kernel 2.6.20-1.2952). we have started mysql without memlock.when we use allocate 1G memory via malloc() mysqld work well. But mysqld was run with memlock .when we use the same as above to allocate 1G memory. mysqld will be rebooted How to repeat: mysqld --memlock #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> int main(int ac, char **av) { long int n,m,i; char *buf; if(ac < 2) { printf("Usage: %s <alloc_size_MB>\n",av[0]); exit(1); } sscanf(av[1],"%d",&n); m=n*1024*1024; printf("Allocating %ld bytes (%d MB), please wait...\n",m,n); buf=malloc(n*1024*1024); for(i=0;i<m;*(buf+i++)=1) ; printf("Done: Allocated %d MB\n",n); printf("Sleeping for 80 seconds...\n"); sleep(80); /* sleep */ } ./testalloc 1000 then view mysql error log. you find that mysqld will be rebooted!