Re: Why doesn't src/backend/port/win32/socket.c implement bind()?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why doesn't src/backend/port/win32/socket.c implement bind()?
Date: 2016-01-11 05:19:01
Message-ID: CAA4eK1L75jQgDY6PL5pSh9OxmDx5eYZX+E5YFZVWVyUXB9ZuEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 10, 2016 at 11:55 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Some of the Windows buildfarm members occasionally fail like this:
>
> LOG: could not bind IPv4 socket: No error
> HINT: Is another postmaster already running on port 64470? If not, wait
a few seconds and retry.
> WARNING: could not create listen socket for "127.0.0.1"
> FATAL: could not create any TCP/IP sockets
>
> (bowerbird, in particular, has a few recent examples)
>
> I think the reason why we're getting "No error" instead of a useful
> strerror report is that socket.c doesn't provide an implementation
> of bind() that includes TranslateSocketError().
>

listen also doesn't have such an implementation and probably few others.

> Why is that?
>

Not sure, but I could see that bind and listen doesn't have the equivalent
Win sock API (checked in winsock2.h) and while googling on same,
I found that there are reasons [1] why Win Sockets doesn't have the
equivalent of some of the socket API's.

I think here we should add a win32 wrapper over bind and listen
API's which ensures TranslateSocketError() should be called for
error cases.

[1] -
http://stackoverflow.com/questions/3255899/why-are-there-wsa-pendants-for-socket-connect-send-and-so-on-but-not-fo

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-01-11 05:30:36 Re: PATCH: add pg_current_xlog_flush_location function
Previous Message Amit Kapila 2016-01-11 04:15:33 Re: PATCH: add pg_current_xlog_flush_location function