Re: [ADMIN] postgresql in FreeBSD jails: proposal

From: Mischa Sandberg <mischa_sandberg(at)telus(dot)net>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [ADMIN] postgresql in FreeBSD jails: proposal
Date: 2008-01-17 22:52:03
Message-ID: 1200610323.478fdc131bb3a@webmail.telus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs pgsql-committers pgsql-general pgsql-hackers pgsql-jdbc pgsql-odbc pgsql-patches

Quoting Stephen Frost <sfrost(at)snowman(dot)net>:

> * Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> > "Marc G. Fournier" <scrappy(at)hub(dot)org> writes:
> > > Easiest fix: change the UID of the user running the postmaster
> (ie. pgsql) so
> > > that each runs as a distinct UID (instead of distinct PGPORT) ...
> been doing
> > > this since moving to FreeBSD 6.x ... no patches required ...
> >
> > Sure, but in the spirit of "belt and suspenders too", I'd think
> that
> > doing that *and* something like Mischa's proposal wouldn't be bad.
>
> I agree that we should try to be careful about stepping on
> segments that might still be in use, but I would also discourage
> jail users from using the same uid for multiple PG clusters
> since the jail doesn't protect the shmem segment.
> We use seperate uids even w/ linux-vservers where shmem
> and everything *is* seperate, following the same
> 'belt and suspenders too' spirit for security.

Thanks for all the input. Fixing freebsd might get answered
on a different channel :-)

Unfortunately, different uid's is not even an option here;
but serious security in this sitch is not relevant, either.

We have a freebsd core guy here, and he says that there's no
pressing incentive for jails to handle sysv ipc, given mmap
and file locking :-( And given his other comments, I wouldn't
consider jails a "secure" environment, just a modest and
convenient way to emulate multiple machines with caveats.
.........................................................
So, given Tom's comment, that it's antisocial to zap a shm seg
that other processes have attached ...

I'm going to skip the kill(1,0) test and depend on nattch only,
with a function that PGSharedMemoryIsInUse() can also use.
(For a healthy server, nattch is never less than 2, right?)
If no unpleasant edge cases come out of this in our test
framework, I'd like to submit that as a patch.
Talked with our Linux guys about vserver, and they see no issues.
Mr. Solaris here is currently a long way ooto ... opinions?

Afaics the change in behaviour is, if a degraded server exited
with some backend hanging, the second server will create a new
segment after bumping the ipc key; if system shm limits do not
allow for two such shm segments, the second server will bail.
For production systems, ensuring no orphan shm segs
is not left to heuristic clean-up by server re-start.

Hope that makes sense for the generic Postgres world.

If anyone is interested in creating hung backends, you can
create a named pipe, and tell the server to COPY from it.
---
Engineers think that equations approximate reality.
Physicists think that reality approximates the equations.
Mathematicians never make the connection.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-general by date

  From Date Subject
Next Message Janine Sisk 2008-01-17 23:02:22 Trouble with UTF-8 data
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2008-01-17 22:52:30 Re: Simple thing to make pg_autovacuum more useful
Previous Message Hope Ho 2008-01-17 22:51:30 modularity of PostgreSQL

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-odbc by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Marc G. Fournier 2008-01-17 22:19:14 Re: [ADMIN] postgresql in FreeBSD jails: proposal

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-01-17 23:10:16 Re: [ADMIN] postgresql in FreeBSD jails: proposal
Previous Message Kevin Grittner 2008-01-17 22:25:36 Re: OUTER JOIN performance regression remains in 8.3beta4