Re: Please review: Authentication after fork

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Please review: Authentication after fork
Date: 2001-06-16 17:28:26
Message-ID: 28289.992712506@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> When the
> max_backend+1'th backend tries to register itself for the shared
> resources I get:

> NOTICE: SIBackendInit: no free procState slot available
> psql: FATAL 1: Backend cache invalidation initialization failed
> [terminates]

This was the test I alluded to as needing to be moved up.

> I'd like to catch this case earlier, to avoid having to wire in such a
> fundamental setting so deeply into the resource management. But I
> couldn't find a good interface to count the already-registered backends.

That would not do: you'd have a race condition, since there might be
free slots when you count but none by the time you want to actually
register. Checking for free slots and acquiring one has to be an atomic
operation.

I've been in that code before; if you like I'll take care of making this
part work more nicely.

> * Is it okay to ignore the count field in the password packet and read
> the actual password like a null-terminated string? That was only there
> for the postmaster way of handling incomplete packets, right?

Seems like we ought to keep the packet-parsing rules the same, to avoid
possible introduction of client compatibility problems.

> * Maybe we need to keep the "poor man's multitasking" code in the
> postmaster to allow for piecewise-arriving startup packets. Surely it
> could be simplified a lot, but I didn't bother with this yet.

Um, shouldn't collection of the startup packet be done after the fork?
I was envisioning that the top process do nothing except accept() and
fork(). So there's no need for pseudo-multitasking: you just have the
one connection to deal with in any one PM child.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-16 18:21:44 Re: Please review: Authentication after fork
Previous Message Peter Eisentraut 2001-06-16 16:46:01 Please review: Authentication after fork