Thread: Adding TCP_USER_TIMEOUT support for libpq/psqlodbc
Hello PostgreSQL Community!
Not long ago I faced the situation concerning ODBC/libpq client hanging in case of some network problems.
I had a discussion regarding this issue within pgsql-odbc@postgresql.org and got some suggestions.
Here is this discussion:
https://www.postgresql.org/message-id/OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B%40iba.by
In a few words the suggestion was to use pqopt keepalive options for ODBC configuration for example as follows:
pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1
But under some circumstances it can be not reliable and the connection can loose its keepalives properties and it can remain hanging.
Here is a quote from our discussion:
Hmm it seems keepalive stops while waiting for ack.
Therefore it's a matter of retransmission control
You can use TCP_USER_TIMEOUT on linux but the option is not used in libpq.
In my opinion it make sense to add the support of TCP_USER_TIMEOUT socket option to libpq/psqlodbc connection.
The attachment contains a patch with the source code changes regarding this issue.
In my implementation it can be configured by new keepalives_user_timeout option within pqopt parameter.
Best regards,
Andrei Yahorau
Not long ago I faced the situation concerning ODBC/libpq client hanging in case of some network problems.
I had a discussion regarding this issue within pgsql-odbc@postgresql.org and got some suggestions.
Here is this discussion:
https://www.postgresql.org/message-id/OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B%40iba.by
In a few words the suggestion was to use pqopt keepalive options for ODBC configuration for example as follows:
pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1
But under some circumstances it can be not reliable and the connection can loose its keepalives properties and it can remain hanging.
Here is a quote from our discussion:
Hmm it seems keepalive stops while waiting for ack.
Therefore it's a matter of retransmission control
You can use TCP_USER_TIMEOUT on linux but the option is not used in libpq.
In my opinion it make sense to add the support of TCP_USER_TIMEOUT socket option to libpq/psqlodbc connection.
The attachment contains a patch with the source code changes regarding this issue.
In my implementation it can be configured by new keepalives_user_timeout option within pqopt parameter.
Best regards,
Andrei Yahorau
Attachment
Hello ,
Did you take a look into the patches from the previous mail ?
What do you think about my proposal ?
Could you please say if there are any objections in regard to it?
Thank you in advance,
Andrei Yahorau
From: Andrei Yahorau/IBA
To: pgsql-hackers@postgresql.org,
Cc: Mikalai Keida/IBA@IBA
Date: 20/07/2018 11:43
Subject: Adding TCP_USER_TIMEOUT support for libpq/psqlodbc
Hello PostgreSQL Community!
Not long ago I faced the situation concerning ODBC/libpq client hanging in case of some network problems.
I had a discussion regarding this issue within pgsql-odbc@postgresql.org and got some suggestions.
Here is this discussion:
https://www.postgresql.org/message-id/OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B%40iba.by
In a few words the suggestion was to use pqopt keepalive options for ODBC configuration for example as follows:
pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1
But under some circumstances it can be not reliable and the connection can loose its keepalives properties and it can remain hanging.
Here is a quote from our discussion:
Hmm it seems keepalive stops while waiting for ack.
Therefore it's a matter of retransmission control
You can use TCP_USER_TIMEOUT on linux but the option is not used in libpq.
In my opinion it make sense to add the support of TCP_USER_TIMEOUT socket option to libpq/psqlodbc connection.
The attachment contains a patch with the source code changes regarding this issue.
In my implementation it can be configured by new keepalives_user_timeout option within pqopt parameter.
[attachment "0001_TCP_USER_TIMEOUT_libpq-int.patch" deleted by Andrei Yahorau/IBA] [attachment "0001_TCP_USER_TIMEOUT_fe-connect.patch" deleted by Andrei Yahorau/IBA]
Best regards,
Andrei Yahorau
Did you take a look into the patches from the previous mail ?
What do you think about my proposal ?
Could you please say if there are any objections in regard to it?
Thank you in advance,
Andrei Yahorau
From: Andrei Yahorau/IBA
To: pgsql-hackers@postgresql.org,
Cc: Mikalai Keida/IBA@IBA
Date: 20/07/2018 11:43
Subject: Adding TCP_USER_TIMEOUT support for libpq/psqlodbc
Hello PostgreSQL Community!
Not long ago I faced the situation concerning ODBC/libpq client hanging in case of some network problems.
I had a discussion regarding this issue within pgsql-odbc@postgresql.org and got some suggestions.
Here is this discussion:
https://www.postgresql.org/message-id/OF33DF00A3.D6444835-ON432582C3.003EA7C5-432582C3.0045562B%40iba.by
In a few words the suggestion was to use pqopt keepalive options for ODBC configuration for example as follows:
pqopt = keepalives=1 keepalives_idle=5 keepalives_count=1 keepalives_interval=1
But under some circumstances it can be not reliable and the connection can loose its keepalives properties and it can remain hanging.
Here is a quote from our discussion:
Hmm it seems keepalive stops while waiting for ack.
Therefore it's a matter of retransmission control
You can use TCP_USER_TIMEOUT on linux but the option is not used in libpq.
In my opinion it make sense to add the support of TCP_USER_TIMEOUT socket option to libpq/psqlodbc connection.
The attachment contains a patch with the source code changes regarding this issue.
In my implementation it can be configured by new keepalives_user_timeout option within pqopt parameter.
[attachment "0001_TCP_USER_TIMEOUT_libpq-int.patch" deleted by Andrei Yahorau/IBA] [attachment "0001_TCP_USER_TIMEOUT_fe-connect.patch" deleted by Andrei Yahorau/IBA]
Best regards,
Andrei Yahorau