On Sunday, March 3, 2019 4:09PM (GMT+9), Fabien COELHO wrote:
>Basically same thing about the tcp_user_timeout guc v8, especially:
> do you have any advice about how I can test the feature, i.e.
> trigger a timeout?
>
>> Patch applies & compiles cleanly. Global check is ok, although there
>> are no specific tests.
>
>> Documentation English can be improved. Could a native speaker help, please?
+1 This needs a help from a native English speaker, cause I am not,
although my name sounds like one. ;)
>> ISTM that the documentation both states that it works and does not
>> work on Windows. One assertion must be false.
>>
>> Syntax error, eg "tcp_user_timeout=2bad", are detected, good.
>
>> I could not really test the feature, i.e. I could not trigger a
>> timeout. Do you have a suggestion on how to test it?
I have also tested the previous patches and most recent one.
I just followed the test instructions above. And maybe you can also do it too.
Here's how I did it.
Setting:
- Before the test via server root user, add the port and client source
using the firewall-cmd to allow client to connect to DB server.
> systemctl start firewalld
> firewall-cmd --add-source={clientipaddress}/32 --add-port={server_port}/tcp --zone=public --permanent
> firewall-cmd --reload
Testing (v8 of user timeout parameters):
[Client-Side]
1. $ psql postgresql://USERNAME:PASSWORD@server_host:server_port/dbname?tcp_user_timeout=15000
2. postgres=# select inet_client_port();
inet_client_port
------------------
34819
3. (Via root user of client, other console window)
root# iptables -I INPUT -p tcp --dport 34819 -j DROP
4. postgres=# select pg_sleep(10);
5. Error output is displayed.
could not receive data from server: Connection timed out
--
Tested again but switching #3 & #4.
There should be a new client port number by then.
Below are the logs in the server.
[Server-Side Logs]
Test#1
[4736] LOG: statement: select inet_client_port();
[4736] LOG: statement: select pg_sleep(10);
[4736] LOG: could not receive data from client: Connection timed out
Test#2
[5594] LOG: statement: select inet_client_port();
[5594] LOG: statement: set tcp_user_timeout=15000;
[5594] LOG: statement: select pg_sleep(10);
[5594] LOG: could not receive data from client: Connection timed out
Regards,
Kirk Jamison