HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Connection timeout errors from Postgres Update Monitor (postgres 9.6)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
updatepostgrestimeoutmonitorerrorsfromconnection

Problem

I am running PostgreSQL 9.6 on windows 10

It seems it has an update monitor that does not use any information about the proxy agent from Windows (we have a corporate proxy). It also does not look at the environment variables HTTP_PROXY or HTTPS_PROXY (which I have set to add credentials via CNTLM for our corporate firewall). This is useful for programs such as NPM and GIT which need to get past our outgoing firewall.

So I am getting the following message every 10 or some minutes as a pop up from a program called:

"D:\Program Files (x86)\postgresql\updatemonitor\bin\UpdManager.exe" --execute "D:\Program Files\PostgreSQL\9.6\bin\stackbuilder.exe"


The message is very deceiving, but I tracked down the program, and it is the one listed above.

Solution

While this answer does not resolve the current question, I think it could be useful for someone searching about Postgres timeout issues on DBA.SE or across the Internet.

According to Postgres documentation, you can use:


statement_timeout (integer)


Abort any statement that takes more than the specified number of
milliseconds, starting from the time the command arrives at the server
from the client. If log_min_error_statement is set to ERROR or lower, the
statement that timed out will also be logged.
A value of zero (the default) turns this off.


Setting statement_timeout in postgresql.conf is not recommended because it would affect all sessions.

That means that you can set it in postgres.conf or you can use it in pgAdmin.

I've found an example in Postgres community.

set statement_timeout to 1000;
select pg_sleep(2);



ERROR: canceling statement due to statement timeout

You can also have different timeout settings per user:

ALTER USER postgres SET statement_timeout=0


And even using a client session via libpq:

From Postgres-XL


When starting a client session via libpq, parameter settings can be
specified using the PGOPTIONS environment variable.
Settings established in this way constitute defaults for the life of the
session, but do not affect other sessions. For historical reasons, the
format of PGOPTIONS is similar to that used when launching the postgres
command; specifically, the -c flag must be specified. For example,

env PGOPTIONS="-c geqo=off -c statement_timeout=5min" psql

Code Snippets

set statement_timeout to 1000;
select pg_sleep(2);
ALTER USER postgres SET statement_timeout=0

Context

StackExchange Database Administrators Q#168402, answer score: 6

Revisions (0)

No revisions yet.