From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 16 14:40:23 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A38405DC for ; Wed, 16 Apr 2014 14:40:23 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD7EF1731 for ; Wed, 16 Apr 2014 14:40:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.8/8.14.8) with ESMTP id s3GEdn3o067358; Wed, 16 Apr 2014 17:39:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s3GEdn3o067358 Received: (from kostik@localhost) by tom.home (8.14.8/8.14.8/Submit) id s3GEdmOH067357; Wed, 16 Apr 2014 17:39:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 16 Apr 2014 17:39:48 +0300 From: Konstantin Belousov To: Jov Subject: Re: Fwd: PostgreSQL hang On FreeBSD, with CFLAGS='-O2 -pthread' workaround Message-ID: <20140416143948.GS4016@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5PFZVUeDPxlnBcQp" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-hackers@freebsd.org 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 14:40:23 -0000 --5PFZVUeDPxlnBcQp Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 16, 2014 at 11:12:52AM +0800, Jov wrote: > move to hacker' list >=20 > this is postgresql thread about this topic: > http://www.postgresql.org/message-id/11613.1397526760@sss.pgh.pa.us >=20 > Jov > blog: http:amutu.com/blog >=20 >=20 > ---------- Forwarded message ---------- > From: Jov > Date: 2014-04-15 9:23 GMT+08:00 > Subject: PostgreSQL hang On FreeBSD,with CFLAGS=3D'-O2 -pthread' workarou= nd > To: FreeBSD questions > Cc: =EB=CF=CE=D3=D4=C1=CE=D4=C9=CE =EB=CE=C9=D6=CE=C9=CB >=20 >=20 > 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. >=20 > there is a solution,which configure postgresql with CFLAGS=3D'-O2 -pthrea= d' > 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. >=20 > knizhnik has some insight: >=20 > > 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 bu= ilt > > as shared library and loaded from application built without -pthread. > > Unfortunately I do not know other solution rather than rebuilt PostgreS= QL > > with pthread. Sorry, that I have not informed you about my investigatio= ns > > and thank you for your help. I also run this test at OS/X - there is no > > such problem. >=20 >=20 > 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) >=20 > the output make me remember some talk about sshd Zombie recently, which > something aoubt libc and libthr. >=20 > is this a known problem with FreeBSD pthread implement? Yes, this is a known issue, libthr.so cannot be loaded dynamically. If the binary could load any dso which is linked with libpthread, threading library must be linked to the binary. I tried to mark it as -z nodlopen some time ago, but it caused too much complains. >=20 > ref: > http://www.postgresql.org/message-id/534785D2.6050105@matrix.gatewaynet.c= om >=20 > https://github.com/knizhnik/imcs/issues/25 >=20 > http://code.google.com/p/plv8js/issues/detail?id=3D34 >=20 > Jov > blog: http:amutu.com/blog > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" --5PFZVUeDPxlnBcQp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTTpY0AAoJEJDCuSvBvK1BFYsP/Ag7CaOkBP/CXtxWVr57gs6Q e06IyTboiDBGk9oFswBmvF6efobbWHeB8VO+U0f+yiD7ljF731js7Cpi1S3kPMxw 85z+n6pyKe7PRdWHjB6/7ZnAKXPGc+AlMJ65aVDTXI3YwVJfdMym4sozM3dY05dT fCEUV8EO6gShvxP0dU/SK1Z7VJ7lGUmHueR+UZdyxTGWyIUJGriwx8A20uCJMtym +4aSk3oKk1GQkGkBx8ZhvoAbSkBo2DeyqMBuZPxhlWlMe+Wt66AUNwlnfskCuO80 qSe6R6ZtWqxCvLfSSCgcpTspr8wAUKLHg1OaMoee1KaeDMw0HpLIR0Qxb9SmpF0S oT1ZbI56YsBFzAmeaon0WC2fei82rFnD1fueqacvsyMq2ucUeVY52lVy/Kk5FRjr oMfkj0BXakuQBXVMZI9l4Uhv8DncjesMGVJVaHfDrZ7Qq9DK1o99oGI4DUHQ9h4C NfK+JH7IjKZWzcCrKG2Y6FPkxE/ZlDSk7Hs0jux5h5CaNEuDWAwO6kebEezf9N3p p6HudfDpFMmZg8SVQ7mgaoATnpKn2m1bFL6uWOPJuJPaDncfYOEBzAO3hzAkM/un FQZ52vK0JMY1BboSFuV47xyKrNyLv3qDT2ruPMIwZDguOJWk9Z+70TTkIYZrXbe2 +0Gp3FIdk/j0z0cdvSzA =WXYh -----END PGP SIGNATURE----- --5PFZVUeDPxlnBcQp--