From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 16 03:13:15 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A6CCC87 for ; Wed, 16 Apr 2014 03:13:15 +0000 (UTC) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB7D511C8 for ; Wed, 16 Apr 2014 03:13:14 +0000 (UTC) Received: by mail-wg0-f47.google.com with SMTP id x12so10228051wgg.18 for ; Tue, 15 Apr 2014 20:13:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=tIx+AtfyTn69SPjq9n+dGSAJAzm0By7dVzDJ2zOfwps=; b=0qjG8FXuOqbV9KR2dG5LavB4F92nSOyatMr4GD/dO50vHjM1yvvnPdrmgLmlTP+T35 WQd4FmUykd5l5QZoOAyXZKKRWxanqao/noRQHgfiW11Zwejk4xfNBWxaD4z7+gY5lBIj obLKp+D2Sm66BkhcQAlfq7InPVGRboKWvoOdqyjvslP/FoPBSAuNoEIkgPaCJQZX+kAX I095aB/5QT35VcRBok6gw/fuPZdk+b547EEbjHkO0qxZJdpakJkRG9P5em4tSfiejktj uEU34xYaH1yh0Ageqcxov2PtbGskkIWXnpZHePj7QwmCRa5jd07p72Q7CUDpSwWtupzO WK7A== X-Received: by 10.180.218.197 with SMTP id pi5mr5190103wic.21.1397617992990; Tue, 15 Apr 2014 20:13:12 -0700 (PDT) MIME-Version: 1.0 Sender: zhao6014@gmail.com Received: by 10.194.25.129 with HTTP; Tue, 15 Apr 2014 20:12:52 -0700 (PDT) In-Reply-To: References: From: Jov Date: Wed, 16 Apr 2014 11:12:52 +0800 X-Google-Sender-Auth: Mc8X_imUKigss2GNiycv50G0Dbg Message-ID: Subject: Fwd: PostgreSQL hang On FreeBSD, with CFLAGS='-O2 -pthread' workaround To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=windows-1251 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.17 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2014 03:13:15 -0000 move to hacker' list this is postgresql thread about this topic: http://www.postgresql.org/message-id/11613.1397526760@sss.pgh.pa.us Jov blog: http:amutu.com/blog ---------- Forwarded message ---------- From: Jov Date: 2014-04-15 9:23 GMT+08:00 Subject: PostgreSQL hang On FreeBSD,with CFLAGS=3D'-O2 -pthread' workaround To: FreeBSD questions Cc: =CA=EE=ED=F1=F2=E0=ED=F2=E8=ED =CA=ED=E8=E6=ED=E8=EA hi~ FreeBSD hackers, I find some problems when use pg on FreeBSD.On FreeBSD,If installed extension which pthread lib is used,for example plv8,pljava,imcs etc,when query touch these extenstions,the PG backend will hang. there is a solution,which configure postgresql with CFLAGS=3D'-O2 -pthread' and compile pg from source ,then install the extension.But this solution is not offical documented and not easy to use(you must compile pg from source).It may make some extension developers or user waste much time to solve it,and make people complain that PG or FreeBSD not stable. knizhnik has some insight: > Actually I have already reproduced the problem with my lockbench test. It > work when build as application with -pthread, but doesn't work if it buil= t > as shared library and loaded from application built without -pthread. > Unfortunately I do not know other solution rather than rebuilt PostgreSQL > with pthread. Sorry, that I have not informed you about my investigations > and thank you for your help. I also run this test at OS/X - there is no > such problem. this is the ldd output: [jovz@ ~]$ ldd pgsql_pthread/bin/postgres pgsql/bin/postgres: libm.so.5 =3D> /lib/libm.so.5 (0x800cd1000) libthr.so.3 =3D> /lib/libthr.so.3 (0x800ef7000) libc.so.7 =3D> /lib/libc.so.7 (0x80111c000) [jovz@ ~]$ ldd pgsql934/bin/postgres pgsql934/bin/postgres: libm.so.5 =3D> /lib/libm.so.5 (0x800cd1000) libc.so.7 =3D> /lib/libc.so.7 (0x800ef7000) the output make me remember some talk about sshd Zombie recently, which something aoubt libc and libthr. is this a known problem with FreeBSD pthread implement? ref: http://www.postgresql.org/message-id/534785D2.6050105@matrix.gatewaynet.com https://github.com/knizhnik/imcs/issues/25 http://code.google.com/p/plv8js/issues/detail?id=3D34 Jov blog: http:amutu.com/blog