[HACKERS] libpq connection status and closed fd

2014-09-22 Thread Daniele Varrazzo
Hello, a psycopg user is reporting [1] that the library is not marking the connection as closed and/or bad after certain errors, such as a connection timeout. He is emulating the error by closing the connection fd (I don't know if the two conditions result in the same effect, but I'll stick to

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Dmitriy Igrishin
2014-09-22 10:42 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com: Hello, a psycopg user is reporting [1] that the library is not marking the connection as closed and/or bad after certain errors, such as a connection timeout. He is emulating the error by closing the connection fd (I

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Daniele Varrazzo
On Mon, Sep 22, 2014 at 8:17 AM, Dmitriy Igrishin dmit...@gmail.com wrote: 2014-09-22 10:42 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com: [2] https://gist.github.com/dvarrazzo/065f343c95f8ea67cf8f Why are you using close() instead of PQfinish()? Because I'm testing for an error,

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Dmitriy Igrishin
2014-09-22 11:35 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com: On Mon, Sep 22, 2014 at 8:17 AM, Dmitriy Igrishin dmit...@gmail.com wrote: 2014-09-22 10:42 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com : [2] https://gist.github.com/dvarrazzo/065f343c95f8ea67cf8f Why

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Marko Tiikkaja
On 9/22/14 9:45 AM, Dmitriy Igrishin wrote: 2014-09-22 11:35 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com: On Mon, Sep 22, 2014 at 8:17 AM, Dmitriy Igrishin dmit...@gmail.com wrote: Why are you using close() instead of PQfinish()? Because I'm testing for an error, please read my

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Dmitriy Igrishin
2014-09-22 12:36 GMT+04:00 Marko Tiikkaja ma...@joh.to: On 9/22/14 9:45 AM, Dmitriy Igrishin wrote: 2014-09-22 11:35 GMT+04:00 Daniele Varrazzo daniele.varra...@gmail.com: On Mon, Sep 22, 2014 at 8:17 AM, Dmitriy Igrishin dmit...@gmail.com wrote: Why are you using close() instead of

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Andres Freund
On 2014-09-22 07:42:01 +0100, Daniele Varrazzo wrote: Hello, a psycopg user is reporting [1] that the library is not marking the connection as closed and/or bad after certain errors, such as a connection timeout. He is emulating the error by closing the connection fd (I don't know if the

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Marko Tiikkaja
On 9/22/14 10:57 AM, Andres Freund wrote: On 2014-09-22 07:42:01 +0100, Daniele Varrazzo wrote: Is this intentional? Is there a better way to check for a broken connection? Note that the libpq code treats connection resets differently from other, arbitrary, errors: I.e. if the kernel returns

Re: [HACKERS] libpq connection status and closed fd

2014-09-22 Thread Tom Lane
Daniele Varrazzo daniele.varra...@gmail.com writes: a psycopg user is reporting [1] that the library is not marking the connection as closed and/or bad after certain errors, such as a connection timeout. He is emulating the error by closing the connection fd That seems like a completely