dbeaver / dbeaver

Free universal database tool and SQL client
https://dbeaver.io
Apache License 2.0
40.6k stars 3.5k forks source link

DBeaver doesn't close sessions to PostgreSQL database #22566

Open AnatoliiYarovyi opened 10 months ago

AnatoliiYarovyi commented 10 months ago

Description

After establishing a connection, it is automatically terminated after 5 minutes. Consequently, you are required to reconnect to the database. However, DBeaver does not close the previous sessions and initiates new ones. As a result, over time, errors started to occur.

Error Message: [ Reason: FATAL: sorry, too many clients already ]

Environment Details:

Screenshot at Jan 23 16-24-30

DBeaver Version

Community Edition 23.3.3

Operating System

macOS Sonoma 14.2.1

Database and driver

1) PostgreSQL 16.1 2) Driver 42.7.1 and others in the screen image

Steps to reproduce

No response

Additional context

No response

LonwoLonwo commented 10 months ago

Hello @AnatoliiYarovyi

What connection type is it?

Also, could you provide screens from these pages of your connection settings?

2024-01-23 18_52_57-Connection _postgres 6 1_ configuration

AnatoliiYarovyi commented 10 months ago

image

image

image

AnatoliiYarovyi commented 10 months ago

@LonwoLonwo I believe I have identified the issue. Initially, when establishing a connection, the 'Local client:' field was not specified (as shown in the attached screenshot). After explicitly specifying this field, the problem of automatic disconnection every 5-10 minutes was resolved.

However, I conducted further testing by waiting for 20 minutes, and everything continued to function correctly. Subsequently, I decided to use the 'Invalidate/Reconnect' option, which resulted in the creation of an additional entry labeled 'DBeaver 23.3.3 - Metadata .' Unfortunately, clicking 'Disconnect' did not remove this old entry.

It seems that explicitly indicating the 'Local client:' resolved the initial issue, but there is a new behavior regarding the persistence of additional entries after using 'Invalidate/Reconnect.

AnatoliiYarovyi commented 10 months ago

I retried the process, and this time everything functioned as expected. It seems that specifying 'Local client:' was indeed the key to resolving this issue. The problem no longer persists, and the connection behaves as it should after specifying this parameter.

AnatoliiYarovyi commented 10 months ago

I apologize for the confusion, but it appears that the issue persists. Here are the steps I have taken:

Created a new connection and specified 'Local Client' similarly. Connected to the database. Left the laptop inactive, and it went into standby mode. Approximately an hour later, I reconnected one connection, and for the second connection, I simply performed a table search. I observed that there were already additional sessions (see screenshot 1). After disconnecting both connections (see screenshot 2), the sessions remained. It seems that the problem still occurs, despite explicitly indicating 'Local Client.' The sessions do not close as expected after disconnecting connections. I appreciate your assistance in resolving this matter.

screenshot 1 Screenshot at Jan 23 22-12-42

screenshot 2 Screenshot at Jan 23 22-19-30

AnatoliiYarovyi commented 10 months ago

By the way, I remembered that the "Local Client" option disappeared after upgrading PostgreSQL from 15 to version 16.

LonwoLonwo commented 10 months ago

By the way, I remembered that the "Local Client" option disappeared after upgrading PostgreSQL from 15 to version 16.

Could you please explain that more? Disappeared from where?

LonwoLonwo commented 10 months ago

We need to test it.

AnatoliiYarovyi commented 10 months ago

@LonwoLonwo

Could you please explain that more? Disappeared from where?

image

and yesterday I selected "Local Client" for another connection and everything worked fine without disconnections every 5-10 minutes

image

serjiokov commented 4 months ago

Hi @AnatoliiYarovyi, in the recent builds, we integrated a feature for configuration termination time (when your connection is nonactive) it might help to investigate how the issue behaves, you can find settings here: image

E1izabeth commented 3 months ago

It's been a while since no update here. If the issue is still actual please let me know and provide additional information regarding our last comment.

AnatoliiYarovyi commented 2 months ago

Hi @serjiokov, please could you explain in more detail what needs to be done Here's what I did image Here's what happened image

just in case, I will add Json a file with the data of the entire table _pg_stat_activity__202408291215.json

AnatoliiYarovyi commented 2 months ago

also changed these settings image after 10 minutes it closed the connection, but the entries in the table remain image

just in case, I will add Json a file with the data of the entire table _pg_stat_activity__202408291215.json

E1izabeth commented 2 months ago

Thank you

Matvey16 commented 1 month ago

@AnatoliiYarovyi I reproduced this issue, thank you for the report