Subject: Re: mysqldump fails under NetBSD
To: matthew sporleder <msporleder@gmail.com>
From: Fredrik Carlsson <fredrik@netbsd.se>
List: netbsd-users
Date: 05/06/2007 09:56:25
This is a multi-part message in MIME format.
--------------040106030203030708060908
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

 >
>>
>>
>> I would be interested in a ktruss of this mysqldump to see what it's
>> doing.  Have you tried dumping to stdout and just redirecting?
>>
>
> Sorry- Do this first:
> Can you also try with options --quick?  The --skip-opt is causing
> mysqldump to attempt dumping to memory first and then to disk (I
> assume this minimizes the time tables are locked).
>
> If you want dumping to memory and it's failing around 2GB, then maybe
> you have a 32bit issue?
>
>

Its the same problem if we only use --quick (-q) and not --skip-opt

ktruss -d -o ktruss.out sh backup_mysql-test.sh
mysqldump: Error 5: Out of memory (Needed 14727464 bytes) when dumping 
table `table` at row: 2644266

I have attached a dump of the ktruss from my last run.

// Fredrik

--------------040106030203030708060908
Content-Type: text/plain;
 name="ktruss.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ktruss.txt"

 27972      1 ktruss   EMUL  "netbsd"
 27972      1 ktruss   CALL  execve(0x7f7fffffe330,0x7f7fffffe838,0x7f7fffffe850)
 27972      1 ktruss   NAMI  "/home/fredrik/bin/sh"
 27972      1 ktruss   RET   execve -1 errno 2 No such file or directory
 27972      1 ktruss   CALL  execve(0x7f7fffffe330,0x7f7fffffe838,0x7f7fffffe850)
 27972      1 ktruss   NAMI  "/bin/sh"
 27972      1 ktruss   NAMI  "/libexec/ld.elf_so"
 27972      1 sh       EMUL  "netbsd"
 27972      1 sh       RET   execve JUSTRETURN
 27972      1 sh       CALL  mmap(0,0x8000,3,0x1002,0xffffffff,0,0)
 27972      1 sh       RET   mmap 140187698954240/0x7f7ffdff8000
 27972      1 sh       CALL  open(0x7f7ffde0a7de,0,0x7f7ffde0a7de)
 27972      1 sh       NAMI  "/etc/ld.so.conf"
 27972      1 sh       RET   open -1 errno 2 No such file or directory
 27972      1 sh       CALL  open(0x7f7fffffe0a0,0,0xfefefefefefeff31)
 27972      1 sh       NAMI  "/lib/libedit.so.2"
 27972      1 sh       RET   open 3
 27972      1 sh       CALL  __fstat30(3,0x7f7fffffdfd0)
 27972      1 sh       RET   __fstat30 0
 27972      1 sh       CALL  mmap(0,0x1000,1,1,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187698950144/0x7f7ffdff7000
 27972      1 sh       CALL  munmap(0x7f7ffdff7000,0x1000)
 27972      1 sh       RET   munmap 0
 27972      1 sh       CALL  mmap(0,0x124000,5,0x14000002,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187694792704/0x7f7ffdc00000
 27972      1 sh       CALL  mmap(0x7f7ffdd1e000,0x2000,3,0x12,3,0x7f7f00000000,0x1e000)
 27972      1 sh       RET   mmap 140187695964160/0x7f7ffdd1e000
 27972      1 sh       CALL  mmap(0x7f7ffdd20000,0x4000,3,0x1012,0xffffffff,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187695972352/0x7f7ffdd20000
 27972      1 sh       CALL  mprotect(0x7f7ffdc1f000,0xff000,0)
 27972      1 sh       RET   mprotect 0
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  open(0x7f7fffffe0a0,0,0xfefefeff2f2d6e72)
 27972      1 sh       NAMI  "/lib/libtermcap.so.0"
 27972      1 sh       RET   open 3
 27972      1 sh       CALL  __fstat30(3,0x7f7fffffdfd0)
 27972      1 sh       RET   __fstat30 0
 27972      1 sh       CALL  mmap(0,0x1000,1,1,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187698950144/0x7f7ffdff7000
 27972      1 sh       CALL  munmap(0x7f7ffdff7000,0x1000)
 27972      1 sh       RET   munmap 0
 27972      1 sh       CALL  mmap(0,0x103000,5,0x14000002,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187692695552/0x7f7ffda00000
 27972      1 sh       CALL  mmap(0x7f7ffdb02000,0x1000,3,0x12,3,0x7f7f00000000,0x2000)
 27972      1 sh       RET   mmap 140187693752320/0x7f7ffdb02000
 27972      1 sh       CALL  mmap(0x7f7ffdb03000,0,3,0x1012,0xffffffff,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187693756416/0x7f7ffdb03000
 27972      1 sh       CALL  mprotect(0x7f7ffda03000,0xff000,0)
 27972      1 sh       RET   mprotect 0
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  open(0x7f7fffffe0a0,0,0xff31302d6e722d62)
 27972      1 sh       NAMI  "/lib/libc.so.12"
 27972      1 sh       RET   open 3
 27972      1 sh       CALL  __fstat30(3,0x7f7fffffdfd0)
 27972      1 sh       RET   __fstat30 0
 27972      1 sh       CALL  mmap(0,0x1000,1,1,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187698950144/0x7f7ffdff7000
 27972      1 sh       CALL  munmap(0x7f7ffdff7000,0x1000)
 27972      1 sh       RET   munmap 0
 27972      1 sh       CALL  mmap(0,0x201000,5,0x14000002,3,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187689549824/0x7f7ffd700000
 27972      1 sh       CALL  mmap(0x7f7ffd8e5000,0xb000,3,0x12,3,0x7f7f00000000,0xe5000)
 27972      1 sh       RET   mmap 140187691536384/0x7f7ffd8e5000
 27972      1 sh       CALL  mmap(0x7f7ffd8f0000,0x11000,3,0x1012,0xffffffff,0x7f7f00000000,0)
 27972      1 sh       RET   mmap 140187691581440/0x7f7ffd8f0000
 27972      1 sh       CALL  mprotect(0x7f7ffd7e5000,0x100000,0)
 27972      1 sh       RET   mprotect 0
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  __sysctl(0x7f7fffffe728,2,0x7f7ffd8ef4e0,0x7f7fffffe720,0,0)
 27972      1 sh       RET   __sysctl 0
 27972      1 sh       CALL  issetugid
 27972      1 sh       RET   issetugid 0
 27972      1 sh       CALL  getpid
 27972      1 sh       RET   getpid 27972/0x6d44, 1119/0x45f
 27972      1 sh       CALL  __sysctl(0x7f7fffffe5f0,2,0x7f7fffffe60c,0x7f7fffffe600,0,0)
 27972      1 sh       RET   __sysctl 0
 27972      1 sh       CALL  readlink(0x7f7ffd7d34ac,0x7f7fffffe620,0x3f)
 27972      1 sh       NAMI  "/etc/malloc.conf"
 27972      1 sh       RET   readlink -1 errno 2 No such file or directory
 27972      1 sh       CALL  mmap(0,0x1000,3,0x1002,0xffffffff,0,0)
 27972      1 sh       RET   mmap 140187698950144/0x7f7ffdff7000
 27972      1 sh       CALL  break(0x523e08)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x524e08)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x525000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x526000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x527000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  geteuid
 27972      1 sh       RET   geteuid 0
 27972      1 sh       CALL  __stat30(0x522508,0x7f7fffffe610)
 27972      1 sh       NAMI  "/var/mail/fredrik"
 27972      1 sh       RET   __stat30 -1 errno 2 No such file or directory
 27972      1 sh       CALL  __stat30(0x41a341,0x7f7fffffe6a0)
 27972      1 sh       NAMI  "."
 27972      1 sh       RET   __stat30 0
 27972      1 sh       CALL  __stat30(0x7f7fffffef48,0x7f7fffffe610)
 27972      1 sh       NAMI  "/root/bin"
 27972      1 sh       RET   __stat30 0
 27972      1 sh       CALL  open(0x7f7fffffe9db,0,0x62)
 27972      1 sh       NAMI  "backup_mysql-test.sh"
 27972      1 sh       RET   open 3
 27972      1 sh       CALL  fcntl(3,0,0xa)
 27972      1 sh       RET   fcntl 10/0xa
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  fcntl(0xa,2,1)
 27972      1 sh       RET   fcntl 0
 27972      1 sh       CALL  getuid
 27972      1 sh       RET   getuid 0
 27972      1 sh       CALL  geteuid
 27972      1 sh       RET   geteuid 0
 27972      1 sh       CALL  getgid
 27972      1 sh       RET   getgid 0
 27972      1 sh       CALL  getegid
 27972      1 sh       RET   getegid 0
 27972      1 sh       CALL  open(0x7f7fffffea52,0,0x5241c0)
 27972      1 sh       NAMI  "/home/fredrik/.shrc"
 27972      1 sh       RET   open 3
 27972      1 sh       CALL  fcntl(3,2,1)
 27972      1 sh       RET   fcntl 0
 27972      1 sh       CALL  break(0x528000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x529000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  read(3,0x528000,0x3f8)
 27972      1 sh       GIO   fd 3 read 136 bytes
       "#	$NetBSD: dot.shrc,v 1.2 2006/09/14 13:01:32 pavel Exp $
	
	. /etc/shrc
	
	case \"$-\" in *i*)
		# interactive mode settings go here
		;;
	esac
       "
 27972      1 sh       RET   read 136/0x88
 27972      1 sh       CALL  open(0x522590,0,0x7d677aff6b7b6c2f)
 27972      1 sh       NAMI  "/etc/shrc"
 27972      1 sh       RET   open 4
 27972      1 sh       CALL  fcntl(4,0,0xa)
 27972      1 sh       RET   fcntl 11/0xb
 27972      1 sh       CALL  close(4)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  fcntl(0xb,2,1)
 27972      1 sh       RET   fcntl 0
 27972      1 sh       CALL  read(0xb,0x528400,0x3f8)
 27972      1 sh       GIO   fd 11 read 259 bytes
       "ll(){ ls -l ${1+\"$@\"}; }
	
	case \"$-\" in *i*)
		PS1=\"${HOST%%.*}$PS1\"
		set -o emacs
		# This file is used by shells that might not support
		# set -o tabcomplete, so check before trying to use it.
		( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete
		;;
	esac
       "
 27972      1 sh       RET   read 259/0x103
 27972      1 sh       CALL  break(0x52a000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  break(0x52b000)
 27972      1 sh       RET   break 0
 27972      1 sh       CALL  read(0xb,0x528400,0x3f8)
 27972      1 sh       GIO   fd 11 read 0 bytes
       ""
 27972      1 sh       RET   read 0
 27972      1 sh       CALL  close(0xb)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  read(3,0x528000,0x3f8)
 27972      1 sh       GIO   fd 3 read 0 bytes
       ""
 27972      1 sh       RET   read 0
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGINT,0,0x7f7fffffe700,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGINT,0x7f7fffffe6d0,0x7f7fffffe6b0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGINT,0,0x7f7fffffe6c0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGINT,0x7f7fffffe6c0,0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigprocmask14(2,0x7f7fffffe720,0)
 27972      1 sh       RET   __sigprocmask14 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGQUIT,0,0x7f7fffffe700,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGQUIT,0x7f7fffffe6d0,0x7f7fffffe6b0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigprocmask14(2,0x7f7fffffe720,0)
 27972      1 sh       RET   __sigprocmask14 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGHUP,0,0x7f7fffffe700,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGHUP,0x7f7fffffe6d0,0x7f7fffffe6b0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigprocmask14(2,0x7f7fffffe720,0)
 27972      1 sh       RET   __sigprocmask14 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGTSTP,0,0x7f7fffffe700,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGTSTP,0x7f7fffffe6d0,0x7f7fffffe6b0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigprocmask14(2,0x7f7fffffe720,0)
 27972      1 sh       RET   __sigprocmask14 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGPIPE,0,0x7f7fffffe700,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigaction_sigtramp(SIGPIPE,0x7f7fffffe6d0,0x7f7fffffe6b0,0x7f7ffd7793dc,2)
 27972      1 sh       RET   __sigaction_sigtramp 0
 27972      1 sh       CALL  __sigprocmask14(2,0x7f7fffffe720,0)
 27972      1 sh       RET   __sigprocmask14 0
 27972      1 sh       CALL  read(0xa,0x521fe0,0x3f8)
 27972      1 sh       GIO   fd 10 read 326 bytes
       "#!/bin/sh
	
	
	ulimit -m unlimited
	ulimit -l unlimited
	ulimit -d `ulimit -d -H`
	
	/usr/pkg/bin/mysqldump -h localhost -B database --quick -u backuper -pXXX > /storage/vol1/backup\
	/mysql/all-sql.sql.new 
	/bin/mv /storage/vol1/backup/mysql/all-sql.sql.new /storage/vol1/backup/mysql/all-sql.sql
	
	exit 0
       "
 27972      1 sh       RET   read 326/0x146
 27972      1 sh       CALL  getrlimit(5,0x7f7fffffe530)
 27972      1 sh       RET   getrlimit 0
 27972      1 sh       CALL  setrlimit(5,0x7f7fffffe530)
 27972      1 sh       RET   setrlimit 0
 27972      1 sh       CALL  getrlimit(6,0x7f7fffffe530)
 27972      1 sh       RET   getrlimit 0
 27972      1 sh       CALL  setrlimit(6,0x7f7fffffe530)
 27972      1 sh       RET   setrlimit 0
 27972      1 sh       CALL  pipe
 27972      1 sh       RET   pipe 3, 4
 27972      1 sh       CALL  fork
 27972      1 sh       RET   fork 6838/0x1ab6
 27972      1 sh       CALL  close(4)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  read(3,0x7f7fffffe430,0x80)
 27972      1 sh       GIO   fd 3 read 8 bytes
       "8388608
       "
 27972      1 sh       RET   read 8
 27972      1 sh       CALL  read(3,0x7f7fffffe430,0x80)
 27972      1 sh       GIO   fd 3 read 0 bytes
       ""
 27972      1 sh       RET   read 0
 27972      1 sh       CALL  close(3)
 27972      1 sh       RET   close 0
 27972      1 sh       CALL  getpgrp
 27972      1 sh       RET   getpgrp 27972/0x6d44
 27972      1 sh       CALL  wait4(0xffffffff,0x7f7fffffe39c,0,0)
 27972      1 sh       RET   wait4 6838/0x1ab6
 27972      1 sh       CALL  getrlimit(2,0x7f7fffffe530)
 27972      1 sh       RET   getrlimit 0
 27972      1 sh       CALL  setrlimit(2,0x7f7fffffe530)
 27972      1 sh       RET   setrlimit 0
 27972      1 sh       CALL  __vfork14
 27972      1 sh       RET   __vfork14 7217/0x1c31
 27972      1 sh       CALL  getpgrp
 27972      1 sh       RET   getpgrp 27972/0x6d44
 27972      1 sh       CALL  wait4(0xffffffff,0x7f7fffffe52c,0,0)
 27972      1 sh       RET   wait4 7217/0x1c31
 27972      1 sh       CALL  __vfork14
 27972      1 sh       RET   __vfork14 20149/0x4eb5
 27972      1 sh       CALL  getpgrp
 27972      1 sh       RET   getpgrp 27972/0x6d44
 27972      1 sh       CALL  wait4(0xffffffff,0x7f7fffffe52c,0,0)
 27972      1 sh       RET   wait4 20149/0x4eb5
 27972      1 sh       CALL  exit(0)

--------------040106030203030708060908--