pgadmin4
pgadmin4 copied to clipboard
Error while fetching stack information (After Tracing into another procedure)
This is an error dialog that keeps popping up while debugging. PG 14.3 Latest version of pgAdmin4 6.19 Web based interface.
Happens if I start an external procedure with BEGIN; or if I debug a procedure that calls another procedure...
Version 6.19 Application Mode Server Current User [email protected] Browser Chrome 109.0.0.0 Operating System Linux-5.15.0-58-generic-x86_64-with-glibc2.35 pgAdmin Database File /var/lib/pgadmin/pgadmin4.db Log File /var/log/pgadmin/pgadmin4.log
== From the LOG FILE: 2023-01-25 17:48:37,483: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:642447 (>Error Message:execute cannot be used while an asynchronous query is underway 2023-01-25 17:49:11,290: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:642447 (>Error Message:execute cannot be used while an asynchronous query is underway 2023-01-25 17:49:21,606: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:642447 (>Error Message:execute cannot be used while an asynchronous query is underway 2023-01-25 17:49:30,966: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:642447 (>Error Message:execute cannot be used while an asynchronous query is underway 2023-01-25 17:57:34,689: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:1951507 >Error Message:ERROR: another debugger is already waiting for that breakpoint
I found similar issue using step over during debug of any procedure. "Error while fetching stack information."
Same "Error while fetching stack information" stepping into or over any line of any function or procedure. This is our first time using the debugger, so I double-checked everything but I can't rule out a configuration/installation issue.
Details:
pgAdmin 4 Windows client v 6.20 Postresql database v14.4 running on RHEL 7 pldebugger installed per https://www.pgadmin.org/docs/pgadmin4/latest/debugger.html postgresql.conf modified with "shared_preload_libraries" Postgresql instance restarted logged in as superuser pldbgapi extension installed in database
The debugger starts up in pgAdmin, prompts for input arguments and positions me on first line of code, then immediately throws the error upon stepping into or over the first line. Upon replying "OK" to that, the debugger advances to the next line, but local variables aren't being updated and database operations like inserts don't appear to be happening. From the pgAdmin log set to "DEBUG" level (full log attachment at bottom):
2023-03-01 13:45:23,989: SQL pgadmin: Execute (dict) by [email protected] on postgres@x108p-ansdb01/web_debug #1 - CONN:2853278 (Query-id: 3941994): SET search_path="$user", public,public;SELECT * FROM pldbg_get_stack(1::int) ORDER BY level
2023-03-01 13:45:23,990: ERROR pgadmin: Failed to execute query (execute_dict) for the server #1- CONN:2853278 (Query-id: 3941994): Error Message:execute cannot be used while an asynchronous query is underway 2023-03-01 13:45:23,996: INFO werkzeug: 127.0.0.1 - - [01/Mar/2023 13:45:23] "�[35m�[1mGET /debugger/execute_query/1330986/get_stack_info HTTP/1.1�[0m" 500 -
From the Postgresql server console (log times are not consistent because logs were collected from multiple attempts):
2023-02-28 17:14:10.144 CST [4565] ERROR: canceling statement due to user request 2023-02-28 17:14:10.144 CST [4565] CONTEXT: PL/pgSQL function testuser.testfunc(text) line 5 at LOOP 2023-02-28 17:14:10.144 CST [4565] STATEMENT: SET search_path="$user", public,public; CALL testuser.testfunc ( 'asdf'::text) 2023-02-28 17:14:43.483 CST [4616] LOG: found leftover debugging target slot for backend 4 2023-02-28 17:14:43.483 CST [4616] CONTEXT: PL/pgSQL function testuser.testfunc(text) line 5 at LOOP 2023-02-28 17:14:43.483 CST [4616] STATEMENT: SET search_path="$user", public,public; CALL testuser.testfunc ( 'asdf'::text)
Googling the "found leftover debugging target" only turned up what appears to be the related source code: https://github.com/soycacan/pldebugger/blob/master/dbgcomm.c
I also found a DBeaver discussion at dbeaver/dbeaver#18892 that seems to be the same issue, but found no other suggestions, and at that point I ran out of ideas for where to look or what to try next.
Sample procedure used with debugger:
CREATE OR REPLACE PROCEDURE testuser.testfunc(IN i_sample_argument text) LANGUAGE plpgsql AS $procedure$ DECLARE v_myvar smallint := 5; BEGIN LOOP EXIT WHEN v_myvar = 0::smallint; begin v_myvar := v_myvar - 1; END; END LOOP; END; $procedure$
Happy to provide more and/or clarifying info as needed, and thanks for your help!
Hi @kirkw and @dba4u
I tested this on the candidate build for v8.7 and could not reproduce the issue. Please test it again after the release of v8.7, scheduled for tomorrow.
No response from the author, hence closing it.