The psql client program from the postgresql-7.4.5 ebuild to connect to a postgresql database server starts allocating memory like crazy when connecting to a database that needs a password. It gets killed after a few seconds by the kernel because it exhausted all the available memory space (1Gb ram + 1Gb swap). Reproducible: Always Steps to Reproduce: 1. merge dev-db/postgresql and follow the instructions to create an initial database 2. become the postgres user, connect with 'psql template1', notice that it logs in just fine 3. alter user postgres with password 'secret'; 4. \q 5. psql template1 6. client appears to login, but soon after gets killed by the kernel: Welcome to psql 7.4.5, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit Killed 7. change /var/lib/postgresql/data/pg_hba.conf to read local all all password 8. /etc/init.d/postgresql restart 9. psql template1 Password: secret 10. client hangs again Actual Results: psql starts allocating hundres of megabytes per second and gets killed quickly by the kernel: oom-killer: gfp_mask=0x1d2 DMA per-cpu: cpu 0 hot: low 2, high 6, batch 1 cpu 0 cold: low 0, high 2, batch 1 Normal per-cpu: cpu 0 hot: low 32, high 96, batch 16 cpu 0 cold: low 0, high 32, batch 16 HighMem per-cpu: cpu 0 hot: low 14, high 42, batch 7 cpu 0 cold: low 0, high 14, batch 7 Free pages: 4500kB (252kB HighMem) Active:127724 inactive:122958 dirty:0 writeback:0 unstable:0 free:1125 slab:2638 mapped:250335 pagetables:798 DMA free:2160kB min:16kB low:32kB high:48kB active:6020kB inactive:5068kB present:16384kB protections[]: 8 476 540 Normal free:2088kB min:936kB low:1872kB high:2808kB active:440860kB inactive:422672kB present:901120kB protections[]: 0 468 532 HighMem free:252kB min:128kB low:256kB high:384kB active:64016kB inactive:64092kB present:131008kB protections[]: 0 0 64 DMA: 0*4kB 0*8kB 1*16kB 1*32kB 3*64kB 1*128kB 1*256kB 1*512kB 1*1024kB 0*2048kB 0*4096kB = 2160kB Normal: 0*4kB 1*8kB 0*16kB 1*32kB 0*64kB 0*128kB 0*256kB 2*512kB 1*1024kB 0*2048kB 0*4096kB = 2088kB HighMem: 1*4kB 1*8kB 1*16kB 1*32kB 1*64kB 1*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 252kB Swap cache: add 387394, delete 387176, find 22457/26983, race 0+1 Out of Memory: Killed process 7568 (psql). Expected Results: Simply log in with the user after supplying the password and not allocating so much memory. hawkeye root # emerge info Portage 2.0.50-r11 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.8-rc3) ================================================================= System uname: 2.6.8-rc3 i686 AMD Athlon(tm) XP 2800+ Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache sandbox" GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://ftp.easynet.nl/mirror/gentoo/ http://gentoo.inode.at/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/bmg-main" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="3dnow 3dnowex X alsa apm avi berkdb bitmap-fonts cdr crypt cups doc dvd dvdr dvdread encode esd faad foomaticdb gd gdbm gif gnome gpm gtk gtk2 gtkhtml imlib imlib2 innodb java jce jpeg libg++ libwww live mad maildir mikmod mmx mmx2 motif mozilla mpeg mysql ncurses network nls oggvorbis opengl oss pam pdflib perl png postgres ppds python quicktime readline sdl slang sse ssl tcltk tcpd theora tiff truetype video_cards_radeon x86 xml xml2 xmms xosd xprint xv xvid zlib" -- Also, to show that this is a client problem, ths is what happens when connecting from a SuSE box with SuSE's supplied psql client progam (after setting tcpip_socket to true in ~postgres/data/postgresql.conf): [00:41] mathias@SuSE:~ > psql --version psql (PostgreSQL) 7.4.2 contains support for command-line editing [00:52] mathias@SuSE:~ > psql -d template1 -U postgres -h hawkeye.hn.org Password: Welcome to psql 7.4.2, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=# This works as espected. There is a similar problem reported on the forums, http://forums.gentoo.org/viewtopic.php?t=232051&highlight=psql use flags for ebuild: dev-db/postgresql-7.4.5 -debug +doc -java +libg++ +nls +pam +perl -pg-hier -pg-intdatetime -pg-vacuumdelay -python +readline +ssl +tcltk +zlib
I can not reproduce the problem. # emerge info Portage 2.0.50-r11 (default-amd64-2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r0, 2.6.8-gentoo-r4) ================================================================= System uname: 2.6.8-gentoo-r4 x86_64 4 Gentoo Base System version 1.4.16 ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CFLAGS="-O2 -pipe" CHOST="x86_64-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /etc/tomcat /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache cvs sandbox" GENTOO_MIRRORS="http://gentoo.osuosl.org http://distro.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X alsa amd64 apache2 apm arts avi berkdb bitmap-fonts cdr cjk crypt cups dvd dvdr encode esd evo f77 foomaticdb gdbm gif gnome gtk gtk2 imlib imlib2 ipv6 java jpeg kde ldap libg++ libwww linguas_ja migemo mikmod motif mozilla mpeg mysql ncurses nls nogcj oggvorbis opengl oss pam pdflib perl png postgres python qt quicktime readline ruby samba sdl slang spell ssl tcltk tcpd truetype unicode xml2 xmms xprint xv zlib"
I'm the one from the forum with the similar problem. Portage 2.0.50-r11 (default-x86-2004.0, gcc-3.3.4, glibc-2.3.3.20040420-r1, 2.6.7) ================================================================= System uname: 2.6.7 i686 AMD Athlon(TM) XP 2000+ Gentoo Base System version 1.4.16 Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/qmail/control /var/spool/fax/etc" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O2 -mcpu=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distcc fixpackages notitles sandbox userpriv usersandbox" GENTOO_MIRRORS="http://gentoo.inode.at/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://dummbo/gentoo-portage" USE="X apache2 apm avi bitmap-fonts bonobo cdr crypt cups curl encode exiscan-acl f77 foomaticdb freetype gd gdbm gif gnome gtk gtk2 gtkhtml guile imlib jpeg ldap libg++ libgd libwww mad maildir mikmod motif mozilla moznocomposer moznoirc moznomail mpeg ncurses nls oggvorbis opengl pam pdflib perl png postgres python quicktime readline slang spell ssl tcltk tcpd tetex threads truetype x86 xml xml2 xmms xprint xv zlib" I emerged postgresql several times to stop this problem but it remains there. I hav no idea anymore.
Not reproducable, try w/ 7.4.13 or >=8.0.8.