RE: Timeout parameters - Mailing list pgsql-hackers

From Jamison, Kirk
Subject RE: Timeout parameters
Date
Msg-id D09B13F772D2274BB348A310EE3027C645C415@g01jpexmbkw24
Whole thread Raw
In response to RE: Timeout parameters  ("Nagaura, Ryohei" <nagaura.ryohei@jp.fujitsu.com>)
Responses RE: Timeout parameters
RE: Timeout parameters
List pgsql-hackers
On Monday, February 25, 2019 1:49 PM (GMT+9), Nagaura, Ryohei wrote:

> Thank you for discussion.
> I made documentation about socket_timeout and reflected Tsunakawa-san's
> comment in the new patch.
> # Mainly only fixing documentation...
> The current documentation of socket_timeout is as follows:
> socket_timeout
> Controls the number of second of client's waiting time for individual socket
> read/write operations. This can be used both as a force global query timeout
> and network problems detector. A value of zero (the default) turns this off.

Thanks for the update.
However, your socket_timeout patch currently does not apply.
$ git apply ../socket_timeout_v5.patch
fatal: corrupt patch at line 24
--> l24: diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c

>socket_timeout
>
> Controls the number of second of client's waiting time for individual socket read/write
> operations. This can be used both as a force global query timeout and network problems
> detector. A value of zero (the default) turns this off.

Got the doc fix. I wonder if we need to document what effect the parameter does:
terminating the connection. How about:

Controls the number of seconds of client-server communication inactivity
before forcibly closing the connection in order to prevent client from
infinite waiting for individual socket read/write operations. This can
be used both as a force global query timeout and network problems 
detector, i.e. hardware failure and dead connection. A value of zero 
(the default) turns this off.

Well, you may remove the "i.e. hardware failure and dead connection" if
that's not necessary.

I know you've only added the doc recommendation.
But regarding the code, you may also fix other parts:
a. Use parse_int_param instead of atoi
>+        conn->socket_timeout = atoi(conn->pgsocket_timeout);

b. proper spacing after comma
>+    {"socket_timeout", NULL, NULL, NULL,
>+        "Socket-timeout","",10,        /* strlen(INT32_MAX) == 10 */
>+    offsetof(struct pg_conn, pgsocket_timeout)},
... 
>+        result = pqSocketCheck(conn,forRead,forWrite,finish_time);

There are probably other parts I missed.

Regards,
Kirk Jamison


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Allowing extensions to supply operator-/function-specific info
Next
From: Haribabu Kommi
Date:
Subject: Re: current_logfiles not following group access and instead followslog_file_mode permissions