Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgAdmin connections remain in connected idle state after closure of query tool #5894

Closed
neilg-gstt opened this issue Feb 23, 2023 · 3 comments
Assignees
Milestone

Comments

@neilg-gstt
Copy link

neilg-gstt commented Feb 23, 2023

Closing the query tool is leaving an open idle connection to the server.

I tend to have a few concurrent open query tool instances. As the connections do not close on closing the query tool window, over time the accumulation of connections can eventually exhaust the connection limit on the server.

I have been mostly using the "Remove Panel" to close the query tool, sometimes I use the X on the top-right hand corner. I'm not sure if this applies to both or just one of the window closure methods.

Note that on closing pgAdmin, the idle connections are closed.

PgAdmin Version: 6.20
Application Mode: Desktop
NW.js Version: 0.72.0
Browser Chromium 109.0.5414.87
Operating System Windows-10-10.0.19044-SP0

Thank you

@andr-c
Copy link

andr-c commented Feb 24, 2023

Same to me - stopped working at all after doing few queries/selects from data view.
I'm running one instance, and after doing logout/login it stopped connecting to a server.
I can see in the logs:

2023-02-24 09:01:15,866: ERROR  pgadmin:        QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00 (Background on this error at: https://sqlalche.me/e/14/3o7r)
Traceback (most recent call last):
  File "/venv/lib/python3.10/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.preprocess_request()
  File "/venv/lib/python3.10/site-packages/flask/app.py", line 1857, in preprocess_request
    rv = self.ensure_sync(before_func)()
  File "/venv/lib/python3.10/site-packages/flask_principal.py", line 477, in _on_before_request
    identity = loader()
  File "/venv/lib/python3.10/site-packages/flask_security/core.py", line 535, in _identity_loader
    if not isinstance(current_user._get_current_object(), AnonymousUserMixin):
  File "/venv/lib/python3.10/site-packages/werkzeug/local.py", line 407, in _get_current_object
    return self.__local()  # type: ignore
  File "/venv/lib/python3.10/site-packages/flask_login/utils.py", line 25, in <lambda>
    current_user = LocalProxy(lambda: _get_user())
  File "/venv/lib/python3.10/site-packages/flask_login/utils.py", line 372, in _get_user
    current_app.login_manager._load_user()
  File "/venv/lib/python3.10/site-packages/flask_login/login_manager.py", line 364, in _load_user
    user = self._user_callback(user_id)
  File "/venv/lib/python3.10/site-packages/flask_security/core.py", line 465, in _user_loader
    user = _security.datastore.find_user(fs_uniquifier=str(user_id))
  File "/venv/lib/python3.10/site-packages/flask_security/datastore.py", line 587, in find_user
    return query.filter_by(**kwargs).first()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2824, in first
    return self.limit(1)._iter().first()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
    result = self.session.execute(
  File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1713, in execute
    conn = self._connection_for_bind(bind)
  File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1552, in _connection_for_bind
    return self._transaction._connection_for_bind(
  File "/venv/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 747, in _connection_for_bind
    conn = bind.connect()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3315, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
    else engine.raw_connection()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3394, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "/venv/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 3361, in _wrap_pool_connect
    return fn()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 327, in connect
    return _ConnectionFairy._checkout(self)
  File "/venv/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/venv/lib/python3.10/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
    rec = pool._do_get()
  File "/venv/lib/python3.10/site-packages/sqlalchemy/pool/impl.py", line 134, in _do_get
    raise exc.TimeoutError(
sqlalchemy.exc.TimeoutError: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30.00 (Background on this error at: https://sqlalche.me/e/14/3o7r)

@pravesh-sharma
Copy link
Contributor

Steps to reproduce the issue

  1. Select any database node and open query tool
  2. Select server node and close query tool using remove panel option from context menu
  3. Check on dashboard the query tool session is not terminated.

@akshay-joshi akshay-joshi moved this to 🏗 In Progress in Current Sprint (184) Mar 1, 2023
@akshay-joshi akshay-joshi added this to the 6.21 milestone Mar 1, 2023
@nikhil-mohite nikhil-mohite moved this from 🏗 In Progress to 🆕 New in Current Sprint (184) Mar 1, 2023
@akshay-joshi akshay-joshi removed this from the 6.21 milestone Mar 1, 2023
@adityatoshniwal adityatoshniwal moved this from 🆕 New to 🏗 In Progress in Current Sprint (184) Mar 17, 2023
adityatoshniwal added a commit to adityatoshniwal/pgadmin4 that referenced this issue Mar 20, 2023
…hema Diff and Debugger to ensure it completes. When closing a browser tab, axios does not guarantee AJAX request completion. pgadmin-org#5894
@adityatoshniwal adityatoshniwal moved this from 🏗 In Progress to In Review in Current Sprint (184) Mar 20, 2023
akshay-joshi pushed a commit that referenced this issue Mar 20, 2023
…hema Diff and Debugger to ensure it completes. When closing a browser tab, axios does not guarantee AJAX request completion. #5894
@akshay-joshi akshay-joshi moved this from In Review to In Testing in Current Sprint (184) Mar 20, 2023
@akshay-joshi akshay-joshi added this to the 7.0 milestone Mar 20, 2023
@yogeshmahajan-1903 yogeshmahajan-1903 self-assigned this Mar 23, 2023
@yogeshmahajan-1903
Copy link
Contributor

This is working fine. Now response to close query tool calls are not cancelled, it will be in pending state, but connection is closed.

@yogeshmahajan-1903 yogeshmahajan-1903 moved this from In Testing to ✅ Done in Current Sprint (184) Mar 24, 2023
akshay-joshi pushed a commit to akshay-joshi/pgadmin4 that referenced this issue Apr 24, 2023
…hema Diff and Debugger to ensure it completes. When closing a browser tab, axios does not guarantee AJAX request completion. pgadmin-org#5894
pravesh-sharma added a commit to pravesh-sharma/pgadmin4 that referenced this issue May 7, 2024
2. Disabled debugger for catalogs. pgadmin-org#6060
3. Fixed an issue where keyboard shortcut for launching debugger from object explorer was working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants