PgBouncer: closing because: client close request and closing because: unclean server

Viewed 419

Although my web app works fine and the data is written into DB without issue. I check the log of PgBouncer, it is showing high amount of

pgbouncer_1        | 2021-04-13 10:45:47.061 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39444 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:47.061 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)
pgbouncer_1        | 2021-04-13 10:45:50.272 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39456 login attempt: db=my_affiliate user=write_user tls=no
pgbouncer_1        | 2021-04-13 10:45:50.273 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 new connection to server (from 172.24.0.4:34854)
pgbouncer_1        | 2021-04-13 10:45:50.282 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39456 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:50.282 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)
pgbouncer_1        | 2021-04-13 10:45:57.770 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39672 login attempt: db=my_affiliate user=write_user tls=no
pgbouncer_1        | 2021-04-13 10:45:57.771 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 new connection to server (from 172.24.0.4:35070)
pgbouncer_1        | 2021-04-13 10:45:57.781 UTC [1] LOG C-0x7f7f368200e0: my_affiliate/write_user@172.24.0.8:39672 closing because: client close request (age=0s)
pgbouncer_1        | 2021-04-13 10:45:57.781 UTC [1] LOG S-0x7f7f36819100: my_affiliate/write_user@172.24.0.11:5432 closing because: unclean server (age=0s)

I was wondering, is that a normal scenario for PgBouncer?

I just perform normal read/ write on DB, with proper connection cleanup.

conn = None
cursor = None

try:        
    conn = psycopg2.connect(constants.POSTGRES_CONNECTION_STRING)        
    cursor = conn.cursor()
    
    ...
    
    conn.commit()
except Exception as e:
    ...
finally:
    if cursor is not None:
        cursor.close()
    
    if conn is not None:
        conn.close()

My setup in docker is also pretty straightforward.

Dockerfile

FROM edoburu/pgbouncer:1.15.0

COPY pgbouncer.ini /etc/pgbouncer/
COPY auth_file /etc/pgbouncer/

pgbouncer.ini

**
#pgbouncer.ini
# Description
# Config file is in “ini” format. Section names are between “[” and “]”.
# Lines starting with “;” or “#” are taken as comments and ignored.
# The characters “;” and “#” are not recognized when they appear later in the line.
[databases]
* = host=postgres port=5432
[pgbouncer]
# Generic settings

# Uncomment this if you want loggin.
#- LOGFILE=/var/log/pgbouncer/pgbouncer.log

listen_addr = 0.0.0.0
auth_file = /etc/pgbouncer/auth_file
auth_type = md5
ignore_startup_parameters = extra_float_digits
# Log settings
admin_users = pgbouncer
# Connection sanity checks, timeouts
# TLS settings
# Dangerous timeouts
################## end file ##################

Do you have any idea why I am getting high number of log messages

  • closing because: client close request
  • closing because: unclean server

Is there ever a concern?

Thanks.

0 Answers
Related