From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Asif Naeem <anaeem(dot)it(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Thom Brown <thom(at)linux(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 9.5: Can't connect with PGSSLMODE=require on Windows |
Date: | 2015-09-28 21:23:16 |
Message-ID: | 20150928212316.GA3474@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2015-09-28 16:57:24 -0400, Tom Lane wrote:
> Asif Naeem <anaeem(dot)it(at)gmail(dot)com> writes:
> > I have spent sometime to investigate the issue, it is reproduciable. In
> > case of Windows, when pqsecure_raw_read() function error code
> > WSAEWOULDBLOCK (EWOULDBLOCK) when no data queued to be read from the non
> > blocking socket there is a need to log retry flag. Related error code can
> > be retrieved via Windows WSAGetLastError() instead of errno, preprocessor
> > SOCK_ERRNO handle it gracefully. PFA patch, it resolve the issue i.e.
>
> > @@ -1601,7 +1601,7 @@ my_sock_read(BIO *h, char *buf, int size)
> > int save_errno;
> >
> > res = pqsecure_raw_read((PGconn *) h->ptr, buf, size);
> > - save_errno = errno;
> > + save_errno = SOCK_ERRNO;
> > BIO_clear_retry_flags(h);
> > if (res < 0)
> > {
>
>
> Great detective work! But if that's broken, then surely the identical
> code in my_sock_write is as well; and the reassignment to errno at the
> bottom of my_sock_read needs to be SOCK_ERRNO_SET(); and why doesn't
> my_sock_write have a reassignment at all?
I wonder if we couldn't remove saving/restoring errno entirely from
my_sock_*. We didn't do so before 680513ab79 and I can't see a reason
why we'd need to now.
What I do find curious is that afaics before 680513ab79 the code also
looked at errno, not SOCK_ERRNO. And apparently things worked back then?
I guess the difference is that pgsecure_raw_read now unconditionally
does SOCK_ERRNO_SET(result_errno).
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-09-28 21:25:03 | Re: 9.5: Can't connect with PGSSLMODE=require on Windows |
Previous Message | Stephen Frost | 2015-09-28 21:13:56 | Re: row_security GUC, BYPASSRLS |