Re: 8.3.5: Crash in CountActiveBackends() - lockless race? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 8.3.5: Crash in CountActiveBackends() - lockless race?
Date
Msg-id 3072.1238422709@sss.pgh.pa.us
Whole thread Raw
In response to Re: 8.3.5: Crash in CountActiveBackends() - lockless race?  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: 8.3.5: Crash in CountActiveBackends() - lockless race?  (Marko Kreen <markokr@gmail.com>)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Marko Kreen wrote:
>> Without reset in ProcArrayRemove we may use some ancient pointer that
>> may point to garbage?  I don't think it's good coding style to allow
>> that to happen.  

> Well, that can happen anyway. CountActiveBackends() could fetch the 
> pointer and determine that it's not NULL, just before ProcArrayRemove 
> clears it.

Dead PGPROC entries are just put into a list for reuse, so the pointer
would still point at storage that looked like a PGPROC.  I concur with
Heikki's theory that the observed crash must have been from fetching a
pointer that was never yet not NULL.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Marko Kreen
Date:
Subject: Re: 8.3.5: Crash in CountActiveBackends() - lockless race?
Next
From: Tom Lane
Date:
Subject: Re: PQinitSSL broken in some use casesf