Re: atexit_callback can be a net negative

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: atexit_callback can be a net negative
Date: 2014-03-07 15:24:31
Message-ID: 15521.1394205871@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-03-07 09:49:05 -0500, Tom Lane wrote:
>> No, I think it should do nothing. The coding pattern shown in bug #9464
>> seems perfectly reasonable and I think we should allow it.

> I don't think it's a reasonable pattern run background processes that
> aren't managed by postgres with all shared memory still
> accessible. You'll have to either also detach from shared memory and
> related things, or you have to fork() and exec().

The code in question is trying to do that. And what do you think will
happen if the exec() fails?

> At the very least, not
> integrating the child with the postmaster's lifetime will prevent
> postgres from restarting because there's still a child attached to the
> shared memory.

I think you're willfully missing the point. The reason we added
atexit_callback was to try to defend ourselves against third-party code
that did things in a non-Postgres-aware way. Arguing that such code
should do things in a Postgres-aware way is not helpful for the concerns
here, and it's not relevant to reality either, because people will load
stuff like libperl into backends. Good luck getting a post-fork
on_exit_reset() call into libperl.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-03-07 15:40:12 Re: Unportable coding in reorderbuffer.h
Previous Message Florian Weimer 2014-03-07 15:13:32 Re: atexit_callback can be a net negative