Re: libpq WSACleanup is not needed

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: James Mansion <james(at)mansionfamily(dot)plus(dot)com>, Jeroen Vermeulen <jtv(at)xs4all(dot)nl>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq WSACleanup is not needed
Date: 2009-01-22 14:56:37
Message-ID: 49788925.8050905@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-01-22 15:00:35 Re: Pluggable Indexes (was Re: rmgr hooks (v2))
Previous Message Euler Taveira de Oliveira 2009-01-22 14:24:25 Re: deductive databases in postgreSQL