pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Tomas Vondra <tv@fuzzy.cz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: overwriting an existing .so while being used crashes the server process
Date: Thu, 31 May 2012 11:09:12 +0300
Message-ID: <1338451752.22408.7.camel@vanquo.pezone.net> (raw)
In-Reply-To: <4FC69487.7000106@fuzzy.cz>
References: <4FC6833C.6080501@fuzzy.cz>
	<8227.1338410155@sss.pgh.pa.us>
	<4FC68C3B.4060609@fuzzy.cz>
	<9187.1338412749@sss.pgh.pa.us>
	<4FC69487.7000106@fuzzy.cz>

On ons, 2012-05-30 at 23:43 +0200, Tomas Vondra wrote:
> On 30.5.2012 23:19, Tom Lane wrote:
> > I suspect it depends on how you install the new version of the library,
> > too.  I would somewhat expect it to work as you're thinking if the
> > install consists of "rename old file out of the way, copy new file into
> > place, unlink old file" or equivalent.  If you are actually
> > *overwriting* the file in place, a crash does not seem especially
> > surprising --- it would make perfect sense if the kernel expects the
> > file to be usable as backing store for the in-memory image, which is not
> > exactly unreasonable.  IOW, if the in-memory bits we're executing are
> > just an mmap'd image of the .so file, changing the .so file could
> > entirely be expected to lead to a crash.
> 
> Aha! That might be the culprit - I've just tested that deleting the olf
> file and copying new version (thus not overwriting it) did not cause a
> crash. Funny.

That's one of the reasons why one normally uses "install" rather than
"cp" to install files.  So this shouldn't be a problem in practice if
people use the provided pgxs infrastructure or something similar.

GNU cp has the --remove-destination option, which should also work for
this purpose.





view thread (6+ messages)

Message-ID: <1338451752.22408.7.camel@vanquo.pezone.net>
Permalink:  ../1338451752.22408.7.camel@vanquo.pezone.net/
Also on:    postgresql.org/message-id/1338451752.22408.7.camel@vanquo.pezone.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: peter_e@gmx.net, tv@fuzzy.cz, tgl@sss.pgh.pa.us
  Subject: Re: overwriting an existing .so while being used crashes the server process
  In-Reply-To: <1338451752.22408.7.camel@vanquo.pezone.net>
  References: <4FC6833C.6080501@fuzzy.cz> <8227.1338410155@sss.pgh.pa.us> <4FC68C3B.4060609@fuzzy.cz> <9187.1338412749@sss.pgh.pa.us> <4FC69487.7000106@fuzzy.cz> <1338451752.22408.7.camel@vanquo.pezone.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox