Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 6D64C1465A38 for ; Wed, 30 May 2012 18:08:26 -0300 (ADT) Received: from [2001:1528:137::f1] (helo=mail.gransy.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SZq80-00087u-2n for pgsql-bugs@postgresql.org; Wed, 30 May 2012 21:08:25 +0000 Received: from antispam.gransy.com (antispam.gransy.com [77.78.104.124]) by mail.gransy.com (Postfix) with ESMTP id 73C5D508905 for ; Wed, 30 May 2012 23:08:11 +0200 (CEST) Received: from mail.gransy.com ([82.208.44.189]) by antispam.gransy.com (antispam.gransy.com [77.78.104.124]) (amavisd-new, port 10024) with ESMTP id 8OItSMd9ln+T for ; Wed, 30 May 2012 23:08:11 +0200 (CEST) Received: by mail.gransy.com (Postfix, from userid 5000) id 61A27508925; Wed, 30 May 2012 23:08:11 +0200 (CEST) Received: from [192.168.1.237] (ip-78-45-133-255.net.upcbroadband.cz [78.45.133.255]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.gransy.com (Postfix) with ESMTPSA id 262C0508905 for ; Wed, 30 May 2012 23:08:11 +0200 (CEST) Message-ID: <4FC68C3B.4060609@fuzzy.cz> Date: Wed, 30 May 2012 23:08:11 +0200 From: Tomas Vondra User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120420 Thunderbird/12.0 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: overwriting an existing .so while being used crashes the server process References: <4FC6833C.6080501@fuzzy.cz> <8227.1338410155@sss.pgh.pa.us> In-Reply-To: <8227.1338410155@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:1528:137::f1 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201205/227 X-Sequence-Number: 33198 On 30.5.2012 22:35, Tom Lane wrote: > Tomas Vondra writes: >> whenever I run a C-function (part of an .so file) and the file is >> overwritten, the connection crashes. Tested on 9.1.3 and 9.2-beta1. > > "Doctor, it hurts when I do this." > "So don't do that." > > What exactly would you expect Postgres to do about such a thing, anyway? > It has no control over people overwriting its executable files. Well, I expected the existing connection will use the old .so, while new connections would use the new version (although they're exactly the same). I suppose there are issues with that option too, but crashing the server is a bit unfortunate ... And it actually happens even when the file is overwritten between two queries. I wonder how this affects installing new versions of extensions - does that mean I can't do that while the database is running? Is this mentioned in the docs, somewhere? IMHO there should be a big red banner "DON'T DO THIS" but all I found is this: http://www.postgresql.org/docs/9.1/interactive/xfunc-c.html After it is used for the first time, a dynamically loaded object file is retained in memory. Future calls in the same session to the function(s) in that file will only incur the small overhead of a symbol table lookup. If you need to force a reload of an object file, for example after recompiling it, begin a fresh session. Which kinda looks like my expectation that the session won't crash was correct. Clearly seems like bug to me. Tomas