Unix Technical Forum

Re: [BUGS] BUG #2724: Could not check connection status with"ssl=on"

This is a discussion on Re: [BUGS] BUG #2724: Could not check connection status with"ssl=on" within the Pgsql Patches forums, part of the PostgreSQL category; --> Based on this report, I have developed the attached patch. Is this OK? The idea is not to call ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 10:31 AM
Bruce Momjian
 
Posts: n/a
Default Re: [BUGS] BUG #2724: Could not check connection status with"ssl=on"


Based on this report, I have developed the attached patch. Is this OK?

The idea is not to call SSL_shutdown() if errno == ECONNRESET.

---------------------------------------------------------------------------

Алексей Заяц wrote:
> Hi.
>
> > I would argue that this is an OpenSSL bug: it should not be trying to
> > write on a connection that it knows perfectly well is already dead.
> > (It should know that, anyway, because the only way that pqReadData would
> > be trying to close the connection is that it got an error indication
> > from OpenSSL.)

> May be, may be...
>
> > Possibly we could work around the problem by disabling SIGPIPE during
> > connection close, but I don't really see why we should have to do that.

> While take a look at source of libpq, i have discover following:
> while reading from pipe, you are getting
> case SSL_ERROR_ZERO_RETURN:
> SOCK_ERRNO_SET(ECONNRESET);
> but why you'r do not check
> SOCK_ERRNO != ECONNRESET
> while closing ssl connection ?
>
> i was trying this and all is work fine.
>
> In function close_SSL you are call SSL_shutdown to shutdown ssl pipe.
> But if you are already get ECONNRESET (by pear?), why you call whi funtcion?
>
> >From openssl docs.

> SSL_shutdown - shuts down an active TLS/SSL connection. It sends the ``close
> notify'' shutdown alert to the peer.
>
> That's why i've got SIGPIPE.
>
> > That's pretty much a waste of time, because all it tells you is whether
> > the connection was good the last time a query was done. It is *not*
> > intended as an active "ping".

> Ok, i'll take it in my mind.
>
> Alexey Zayats.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq


--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 10:31 AM
Tom Lane
 
Posts: n/a
Default Re: Re: [BUGS] BUG #2724: Could not check connection status with "ssl=on"

Bruce Momjian <bruce@momjian.us> writes:
> ! if (SOCK_ERRNO != ECONNRESET)
> ! SSL_shutdown(conn->ssl);


Ummm ... what is this supposed to fix exactly, and what are the odds
that it will introduce resource leaks?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 10:31 AM
Bruce Momjian
 
Posts: n/a
Default Re: Re: [BUGS] BUG #2724: Could not checkconnection status with "ssl=on"

Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > ! if (SOCK_ERRNO != ECONNRESET)
> > ! SSL_shutdown(conn->ssl);

>
> Ummm ... what is this supposed to fix exactly, and what are the odds


I think the user was getting SIGPIPE on SSL_shutdown() of a closed
connection.

> that it will introduce resource leaks?


I don't know myself. If some SSL expert says it is OK, we apply it, if
not, we ignore the patch.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 10:31 AM
Tom Lane
 
Posts: n/a
Default Re: Re: [BUGS] BUG #2724: Could not check connection status with "ssl=on"

Bruce Momjian <bruce@momjian.us> writes:
> Tom Lane wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>>> ! if (SOCK_ERRNO != ECONNRESET)
>>> ! SSL_shutdown(conn->ssl);

>>
>> Ummm ... what is this supposed to fix exactly, and what are the odds


> I think the user was getting SIGPIPE on SSL_shutdown() of a closed
> connection.


It seems moderately improbable that by the time control arrives here,
errno still has anything to do with the last operation on the SSL
socket.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:38 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com