pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.4k stars 632 forks source link

SELECT bug 'Total rows: 0 of X' #7155

Open MysteriousNothing opened 7 months ago

MysteriousNothing commented 7 months ago

Describe the bug Sometime SELECT return 0 of X data and displays nothing. For example there LIMIT 10 with Total rows: 0 of 10 And it does not display 10 rows.

To Reproduce It's quite random, it's sometimes happens.

Expected behavior return every time rows not 0 out 10, display nothing

Screenshots image

Same request 1s later image

If applicable, add screenshots to help explain your problem.

Additional context

2-3 months ago I did not have this .

pravesh-sharma commented 7 months ago

Hi @MysteriousNothing

I am not able to reproduce the issue. Can you please share logs?

MysteriousNothing commented 7 months ago

Hi @MysteriousNothing

I am not able to reproduce the issue. Can you please share logs?

Closest error when this happens is:

SQL state: 57014
2024-02-05 15:52:25,506: WARNING        werkzeug:       Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead.

image

For full log, I need more time, it contains peoples personal data, I can't upload it raw, may take days or week

Here is some part:

2024-02-04 12:55:33,038: ERROR  pgadmin:    Connection (id #3816213) lost for the server (#23) on database (poland)
2024-02-04 13:28:52,548: ERROR  pgadmin:    Task <Task pending coro=<AsyncDictCursor._execute() running at /usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py:292> cb=[_run_until_complete_cb() at /usr/lib/python3.7/asyncio/base_events.py:158]> got Future <Future pending> attached to a different loop
Traceback (most recent call last):
  File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py", line 281, in execute
    return asyncio.run(self._execute(query, params))
  File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py", line 292, in _execute
    return await _async_cursor.execute(self, query, params)
  File "/usr/pgadmin4/venv/lib/python3.7/site-packages/psycopg/cursor_async.py", line 89, in execute
    async with self._conn.lock:
  File "/usr/lib/python3.7/asyncio/locks.py", line 92, in __aenter__
    await self.acquire()
  File "/usr/lib/python3.7/asyncio/locks.py", line 192, in acquire
    await fut
RuntimeError: Task <Task pending coro=<AsyncDictCursor._execute() running at /usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py:292> cb=[_run_until_complete_cb() at /usr/lib/python3.7/asyncio/base_events.py:158]> got Future <Future pending> attached to a different loop
2024-02-04 13:43:16,590: ERROR  pgadmin:    dictionary changed size during iteration
Traceback (most recent call last):
  File "/usr/pgadmin4/venv/lib/python3.7/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/pgadmin4/venv/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/pgadmin4/venv/lib/python3.7/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
  File "/usr/pgadmin4/web/pgadmin/dashboard/__init__.py", line 267, in wrap
    kwargs['sid']
  File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/__init__.py", line 117, in connection_manager
    manager._restore_connections()
  File "/usr/pgadmin4/web/pgadmin/utils/driver/psycopg3/server_manager.py", line 393, in _restore_connections
    for conn_id in self.connections:
RuntimeError: dictionary changed size during iteration
2024-02-04 14:38:59,822: ERROR  pgadmin:    Failed to execute query (execute_async) for the server #23 - CONN:3567045(Query-id: 7152423):
Error Message:ERROR:  canceling statement due to user request
CONTEXT:  PL/pgSQL function dual_reg_range_val_d(dual_reg[],date,text,text,text,text,text) line 11 at FOR over SELECT rows
PL/pgSQL function noue_viivis_arvuta_v2(integer,date,date,integer) line 571 at assignment
SQL statement "SELECT * 
                                                               FROM public.noue_viivis_arvuta_v2($1, $2, $3, $5)"
PL/pgSQL function noue_viivis_arvuta(integer,date,date,integer,integer,text) line 21 at SQL statement
SQL statement "SELECT viivis, fix_viivis                                                    FROM noue_viivis_arvuta(noue.counter, noue.Viivise_arvutus_alates, kuupaev, 0, noue.viivisePiirangId, NULL)"
PL/pgSQL function noue_uuenda_summasid(integer,integer,boolean) line 86 at SQL statement
SQL statement "SELECT noue_uuenda_summasid(NULL, NULL, false)"
PL/pgSQL function noue_uuenda_summasid() line 3 at PERFORM 

SQL state: 57014
2024-02-04 14:49:13,271: ERROR  pgadmin:    Failed to execute query (execute_async) for the server #23 - CONN:9095557(Query-id: 2588617):
Error Message:ERROR:  syntax error at or near "05092"
LINE 3: 05092, 205091, 205090, 205089, 205088, 205087, 205086, 20508...
        ^ 

2024-02-04 18:34:26,273: ERROR  pgadmin:    Connection (id #6943001) lost for the server (#23) on database (poland)
2024-02-05 07:40:18,748: WARNING    werkzeug:   Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead.
2024-02-05 08:56:28,149: ERROR  pgadmin:    'TableCommand' object has no attribute 'conn_id_ac'
2024-02-05 08:56:31,225: ERROR  pgadmin:    'TableCommand' object has no attribute 'conn_id_ac'
2024-02-05 08:56:37,108: ERROR  pgadmin:    'TableCommand' object has no attribute 'conn_id_ac'
2024-02-05 08:57:35,073: ERROR  pgadmin:    'TableCommand' object has no attribute 'conn_id_ac'
2024-02-05 10:12:02,510: ERROR  pgadmin:    Failed to execute query (execute_async) for the server #5 - CONN:5406370(Query-id: 3093904):
Error Message:ERROR:  canceling statement due to user request 

SQL state: 57014
2024-02-05 15:52:25,506: WARNING    werkzeug:   Werkzeug appears to be used in a production deployment. Consider switching to a production web server instead.

Hope this will help

MysteriousNothing commented 7 months ago

just happened again and no log input.

akshay-joshi commented 5 months ago

Hi @MysteriousNothing

I am unable to reproduce the issue. I have tried with the remote server as well as the local database server. I have run the query very quickly multiple times, but still unable to reproduce the issue.

Issue_total_rows

MysteriousNothing commented 5 months ago

Hi @MysteriousNothing

I am unable to reproduce the issue. I have tried with the remote server as well as the local database server. I have run the query very quickly multiple times, but still unable to reproduce the issue.

Issue_total_rows

There is no errors on the log when this happens

https://github.com/pgadmin-org/pgadmin4/assets/25065431/56ad7248-e463-4774-b89e-f1ed5c8b9271

How to I make sure pgAdmin uses pip3?

I think fault is in that I have two versions in my computer...


henry@development:~$ cat /usr/pgadmin4/venv/pyvenv.cfg 
home = /usr/bin
include-system-site-packages = false
version = 3.7.3

Do I need have this like this?

image

pravesh-sharma commented 5 months ago

Hi @MysteriousNothing,

The video you have shared is broken, can you please share it again?

MysteriousNothing commented 5 months ago

Hi @MysteriousNothing,

The video you have shared is broken, can you please share it again?

https://github.com/pgadmin-org/pgadmin4/assets/25065431/9b41a681-efca-402c-9796-22b535314cdd

anilsahoo20 commented 4 months ago

@MysteriousNothing The video is still broken, please share it again.

MysteriousNothing commented 4 months ago

@MysteriousNothing The video is still broken, please share it again.

You have codex issues with you own computer if you can't see this video.

It's just demonstration that if I have this error there is no log entery

adityatoshniwal commented 4 months ago

@anilsahoo20 I'm able to view the video.

adityatoshniwal commented 4 months ago

I was able to reproduce it randomly once with below error in backend:

RuntimeError: <asyncio.locks.Lock object at 0x10c5f23f0 [unlocked, waiters:1]> is bound to a different event loop
2024-05-06 16:27:35,384: ERROR  pgadmin:    <asyncio.locks.Lock object at 0x10c5f23f0 [unlocked, waiters:1]> is bound to a different event loop
Traceback (most recent call last):
  File "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py", line 281, in execute
    return asyncio.run(self._execute(query, params))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/driver/psycopg3/cursor.py", line 292, in _execute
    return await _async_cursor.execute(self, query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/adityatoshniwal/venv/pypg312/lib/python3.12/site-packages/psycopg/cursor_async.py", line 89, in execute
    async with self._conn.lock:
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/locks.py", line 105, in acquire
    fut = self._get_loop().create_future()
          ^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/mixins.py", line 20, in _get_loop
    raise RuntimeError(f'{self!r} is bound to a different event loop')