From: | Chris Withers <chris(at)simplistix(dot)co(dot)uk> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: connection file descriptors created with identical number after process fork on mac |
Date: | 2016-08-03 23:25:09 |
Message-ID: | a134ef69-b918-2222-2902-ca9d43109129@simplistix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 04/08/2016 00:20, Tom Lane wrote:
> Chris Withers <chris(at)simplistix(dot)co(dot)uk> writes:
>> I'm writing some multi-process code in Python and trying to make sure I
>> open a new connection for each process. Here's the really cut down code:
>> ...
>> What's really surpising to me is the output on a mac:
>
>> $ python psycopg2_multiprocess.py
>> 44276 child fd: 13
>> 44277 child fd: 13
>> 44278 child fd: 13
>> 44279 child fd: 13
>
>> The getpid() output indicates that the connec() call is being made
>> inside a different process each time, yet the connection appears to
>> still be using the same fd.
>
> FD numbers are process-local in all flavors of Unix. The above only
> proves that all of these processes had FDs 0..12 open already, which
> doesn't seem terribly surprising.
Thanks, that's certainly good news!
How can I convince myself, from the client side, that I really have got
a new connection and not somehow ended up with one that been passed on
as part of the fork?
cheers,
Chris
From | Date | Subject | |
---|---|---|---|
Next Message | John R Pierce | 2016-08-03 23:40:56 | Re: connection file descriptors created with identical number after process fork on mac |
Previous Message | Tom Lane | 2016-08-03 23:20:00 | Re: connection file descriptors created with identical number after process fork on mac |