Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E9604B5DBCE for ; Tue, 26 Jul 2011 15:08:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 66054-02 for ; Tue, 26 Jul 2011 18:08:39 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 4E94DB5DBC4 for ; Tue, 26 Jul 2011 15:08:39 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p6QI7HJT013572; Tue, 26 Jul 2011 14:07:18 -0400 (EDT) To: noordsij cc: Stefan Kaltenbrunner , Alvaro Herrera , Robert Haas , Pg Bugs Subject: Re: BUG #6086: Segmentation fault In-reply-to: References: <201106300732.p5U7W0Bj001711@wwwmaster.postgresql.org> <1311609295-sup-6784@alvh.no-ip.org> <4E2DA57D.5010100@kaltenbrunner.cc> Comments: In-reply-to noordsij message dated "Tue, 26 Jul 2011 16:54:45 +0300" Date: Tue, 26 Jul 2011 14:07:17 -0400 Message-ID: <13571.1311703637@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-3.091 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-1.191 X-Spam-Level: X-Archive-Number: 201107/178 X-Sequence-Number: 30790 noordsij writes: > After a few hours of watching strange things happening I finally stumbled > on the cause. > Very short summary: the postgres binary needs to be linked to libpthread, > as this will ensure a special fork() inside libthr (the FreeBSD libpthread > implementation/wrapper) is used which correctly deals with any pthread > usage (I am guessing especially statically initialized pthread_X variables > in for example libxml2). > This can be accomplished by adding "-lpthread" to the LDFLAGS when building > either libxml2 or postgresql itself, or by preloading libpthread.so when > starting postgresql. Linking pthreads into the backend is likely to cause more problems than it solves, especially if you're proposing that we do that everywhere. regards, tom lane