From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
Cc: | Florian Weimer <fweimer(at)redhat(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: atexit_callback can be a net negative |
Date: | 2014-03-07 14:57:14 |
Message-ID: | 14684.1394204234@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> On 03/07/2014 04:23 PM, Florian Weimer wrote:
>> There's the PID reuse problem. Forking twice (with a delay) could end
>> up with the same PID as MyProcPid.
> Not if the parent process is still running.
If the original parent backend is *not* still running, then running
atexit_callback in the grandchild is just as dangerous if not more so;
it could be clobbering shared-memory state belonging to some other
session that has recycled the same PGPROC.
I think Florian's right that there's a risk there, but it seems pretty
remote, and I don't see any reliable way to detect the case anyhow.
(Process start time? Where would you get that from portably?)
It's not a reason not to do something about the much larger chance of
this happening in a direct child process, which certainly won't have a
matching PID.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Florian Weimer | 2014-03-07 15:02:17 | Re: atexit_callback can be a net negative |
Previous Message | Tom Lane | 2014-03-07 14:49:05 | Re: atexit_callback can be a net negative |