Open nkPit opened 2 days ago
Hmm, I want to note that we did not have a 1.5.1 release yet. Are you testing on the current HEAD or on some previous commit?
Yes. In this case, I'm working with HEAD. But this problem is also present on 1.5.0
Unfortunately I couldn't reproduce the issue using your script using pg_repack 1.5.1 and Postgres 16.2 (although I may recheck it with Postgres 16.3).
According to the dump, the segfault happens within PQconnectdbParams()
which wasn't used on 1.5.0, it was introduced only by 1.5.1:
https://github.com/Melkij/pg_repack/blob/f3d47e5108e5a3dd89e68c48bc659c94713a1056/doc/pg_repack.rst#releases
Unfortunately I couldn't reproduce the issue using your script using pg_repack 1.5.1 and Postgres 16.2 (although I may recheck it with Postgres 16.3).
I tried to reproduce the issue with Postgres 16.3 and I cannot reproduce it neither.
@nkPit do you use Postgres instance provided by a Ubuntu package? Or did you build it by yourself?
49802 pgut_command (conn=conn@entry=0x55a649b24a80, query=query@entry=0x55a649afbc1f "RESET lock_timeout", nParams=nParams@entry=0, params=params@entry=0x0) at pgut/pgut.c:688
Additionally it seems that pgut_execute()
failed during calling RESET lock_timeout
within lock_exclusive()
. Can you share that error?
do you use Postgres instance provided by a Ubuntu package? Or did you build it by yourself?
Postgres was built by myself. Config:
./configure --enable-tap-tests --enable-debuge --enable-cassert && make -j8 && make check
test@ubuntu-2204:~/test/postgres$ git branch
* REL_16_STABLE
master
git log
commit 7857c8dc4481970c27a44a4d1073064ff674b1de (HEAD -> REL_16_STABLE, origin/REL_16_STABLE)
Can you share that error?
I'm not quite sure what I have to show here. The only thing I have is backtrace.
Postgres was built by myself.
Can you try to rebuild your Postgres by running the command make distclean && make && make install
to make sure that you don't have any artefacts from previous build?
I'm not quite sure what I have to show here. The only thing I have is backtrace.
Your PostgreSQL logs might contain any errors which was raised during running pg_repack. Could you check it and provide it if there is any relevant error?
After make install
tail -n 20 logfile
2024-07-01 12:58:53.135 UTC [335388] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-01 12:58:53.135 UTC [335388] STATEMENT: RESET lock_timeout
2024-07-01 12:58:53.138 UTC [335390] ERROR: syntax error at or near "16460" at character 12
2024-07-01 12:58:53.138 UTC [335390] STATEMENT: LOCK TABLE 16460 IN ACCESS EXCLUSIVE MODE
2024-07-01 12:58:53.138 UTC [335390] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-01 12:58:53.138 UTC [335390] STATEMENT: RESET lock_timeout
2024-07-01 12:58:53.141 UTC [335392] ERROR: syntax error at or near "16460" at character 12
2024-07-01 12:58:53.141 UTC [335392] STATEMENT: LOCK TABLE 16460 IN ACCESS EXCLUSIVE MODE
2024-07-01 12:58:53.141 UTC [335392] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-01 12:58:53.141 UTC [335392] STATEMENT: RESET lock_timeout
2024-07-01 12:58:53.144 UTC [335394] ERROR: syntax error at or near "16460" at character 12
2024-07-01 12:58:53.144 UTC [335394] STATEMENT: LOCK TABLE 16460 IN ACCESS EXCLUSIVE MODE
2024-07-01 12:58:53.145 UTC [335394] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-01 12:58:53.145 UTC [335394] STATEMENT: RESET lock_timeout
2024-07-01 12:58:55.804 UTC [322919] LOG: received smart shutdown request
2024-07-01 12:58:55.806 UTC [322919] LOG: background worker "logical replication launcher" (PID 322925) exited with exit code 1
2024-07-01 12:58:55.806 UTC [322920] LOG: shutting down
2024-07-01 12:58:55.807 UTC [322920] LOG: checkpoint starting: shutdown immediate
2024-07-01 12:58:55.856 UTC [322920] LOG: checkpoint complete: wrote 943 buffers (5.8%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.020 s, sync=0.025 s, total=0.050 s; sync files=326, longest=0.001 s, average=0.001 s; distance=4442 kB, estimate=4442 kB; lsn=0/193DBA0, redo lsn=0/193DBA0
2024-07-01 12:58:55.862 UTC [322919] LOG: database system is shut down
2024-07-01 12:58:53.138 UTC [335390] ERROR: syntax error at or near "16460" at character 12 2024-07-01 12:58:53.138 UTC [335390] STATEMENT: LOCK TABLE 16460 IN ACCESS EXCLUSIVE MODE
Can you show output of the query:
select relname, relid, lock_table from repack.tables;
Reinstalled postgres and pg_repack. The log has changed a bit.
contrib_regression=# select relname, relid, lock_table from repack.tables;
relname | relid | lock_table
-------------------+-------+-------------------------------------------------------
public.tbl_nn | 16423 | LOCK TABLE public.tbl_nn IN ACCESS EXCLUSIVE MODE
public.tbl_uk | 16433 | LOCK TABLE public.tbl_uk IN ACCESS EXCLUSIVE MODE
public.tbl_nn_puk | 16453 | LOCK TABLE public.tbl_nn_puk IN ACCESS EXCLUSIVE MODE
public.tbl_nn_uk | 16441 | LOCK TABLE public.tbl_nn_uk IN ACCESS EXCLUSIVE MODE
public.tbl_pk_uk | 16446 | LOCK TABLE public.tbl_pk_uk IN ACCESS EXCLUSIVE MODE
public.testts1 | 16427 | LOCK TABLE public.testts1 IN ACCESS EXCLUSIVE MODE
(6 rows)
test@ubuntu-2204:~/test$ tail -n 20 logfile
2024-07-02 05:57:17.491 UTC [520854] ERROR: relation "repack.log_16427" does not exist
2024-07-02 05:57:17.491 UTC [520854] STATEMENT: LOCK TABLE repack.log_16427 IN ACCESS EXCLUSIVE MODE
2024-07-02 05:57:17.491 UTC [520854] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-02 05:57:17.491 UTC [520854] STATEMENT: RESET lock_timeout
2024-07-02 05:57:17.495 UTC [520856] ERROR: relation "repack.log_16427" does not exist
2024-07-02 05:57:17.495 UTC [520856] STATEMENT: LOCK TABLE repack.log_16427 IN ACCESS EXCLUSIVE MODE
2024-07-02 05:57:17.495 UTC [520856] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-02 05:57:17.495 UTC [520856] STATEMENT: RESET lock_timeout
2024-07-02 05:57:17.499 UTC [520858] ERROR: relation "repack.log_16427" does not exist
2024-07-02 05:57:17.499 UTC [520858] STATEMENT: LOCK TABLE repack.log_16427 IN ACCESS EXCLUSIVE MODE
2024-07-02 05:57:17.499 UTC [520858] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-02 05:57:17.499 UTC [520858] STATEMENT: RESET lock_timeout
2024-07-02 05:57:17.503 UTC [520860] ERROR: relation "repack.log_16427" does not exist
2024-07-02 05:57:17.503 UTC [520860] STATEMENT: LOCK TABLE repack.log_16427 IN ACCESS EXCLUSIVE MODE
2024-07-02 05:57:17.503 UTC [520860] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-02 05:57:17.503 UTC [520860] STATEMENT: RESET lock_timeout
2024-07-02 05:57:17.507 UTC [520862] ERROR: relation "repack.log_16427" does not exist
2024-07-02 05:57:17.507 UTC [520862] STATEMENT: LOCK TABLE repack.log_16427 IN ACCESS EXCLUSIVE MODE
2024-07-02 05:57:17.507 UTC [520862] ERROR: current transaction is aborted, commands ignored until end of transaction block
2024-07-02 05:57:17.507 UTC [520862] STATEMENT: RESET lock_timeout
Hello! I get a Segmentation fault when trying to execute
pg_repack --dbname=contrib_regression
The backtrace is very large:To reproduce the issue, four files are needed:
The reproduction script itself:
for i in $(seq 20) ; do ~/run_test ; if coredumpctl ; then break; fi ; done
Postgres version:
pg_repack version:
pg_repack | 1.5.1 | public | Reorganize tables in PostgreSQL databases with minimal locks
The system on which it was run:
Best regards, Nikita Kalinin Postgres Professional