Re: libpq WSACleanup is not needed - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: libpq WSACleanup is not needed
Date
Msg-id 49788925.8050905@esilo.com
Whole thread Raw
In response to Re: libpq WSACleanup is not needed  (Magnus Hagander <magnus@hagander.net>)
Responses Re: libpq WSACleanup is not needed  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Magnus Hagander wrote:
> Andrew Chernow wrote:
>> Magnus Hagander wrote:
>>> In which case, we should perhaps just document the workaround using
>>> WSAStartup() yourself, and not bother with either API or connection
>>> parameter...
>>>
>>>
>> I didn't originally agree with this but now I do.  Any libpq init
>> function for wsa, would only be replacing an app calling WSAStartup
>> themselves.  So, why have it at all.
> 
> Ok, I think we're fairly agreed that this is the way to proceed then. Do
> you want to propose some wording for the documentation, or should I try
> to write something myself?
> 
> //Magnus
> 
> 

I can try.  Where should this be documented?  ISTM that the best place 
is at the top of "30.1 Database Connection Control Functions", since the 
issue pertains to any connect/disconnect function.  Does that sound 
correct?  Should it be a warning or just regular text?

First attempt:

"On windows, libpq issues a WSAStartup and WSACleanup on a per 
connection basis.  Each WSAStartup increments an internal reference 
count which is decremented by WSACleanup.  Calling WSACleanup with a 
reference count of zero, forces all resources to be freed and DLLs to be 
unloaded.  This is an expensive operation that can take as much as 
300ms.  This overhead can be seen if an application does not call 
WSAStartup and it closes its last PGconn.  To avoid this, an application 
should manually call WSAStartup."

-- 
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/


pgsql-hackers by date:

Previous
From: Euler Taveira de Oliveira
Date:
Subject: Re: deductive databases in postgreSQL
Next
From: Simon Riggs
Date:
Subject: Re: Pluggable Indexes (was Re: rmgr hooks (v2))