Re: overwriting an existing .so while being used crashes the server process

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: overwriting an existing .so while being used crashes the server process
Date: 2012-05-30 21:08:11
Message-ID: 4FC68C3B.4060609@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 30.5.2012 22:35, Tom Lane wrote:
> Tomas Vondra <tv(at)fuzzy(dot)cz> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Patric Bechtel 2012-05-30 21:12:03 pg_dump/pg_restore with time zone displacement out of range
Previous Message Tom Lane 2012-05-30 20:35:55 Re: overwriting an existing .so while being used crashes the server process