Crash after a call to pg_backup_start() - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Crash after a call to pg_backup_start()
Date
Msg-id 20221021.161038.1277961198945653224.horikyota.ntt@gmail.com
Whole thread Raw
Responses Re: Crash after a call to pg_backup_start()  (Richard Guo <guofenglinux@gmail.com>)
List pgsql-hackers
While playing with a proposed patch, I noticed that a session crashes
after a failed call to pg_backup_start().

postgres=# select pg_backup_start(repeat('x', 1026));
ERROR:  backup label too long (max 1024 bytes)
postgres=# \q
> TRAP: failed Assert("during_backup_start ^ (sessionBackupState == SESSION_BACKUP_RUNNING)"), File: "xlog.c", Line:
8846,PID: 165835
 

Surprisingly this happens by a series of succussful calls to
pg_backup_start and stop.

postgres=# select pg_backup_start('x');
postgres=# select pg_backup_top();
postgres=# \q
> TRAP: failed Assert("durin..


>> do_pg_abort_backup(int code, Datum arg)
>     /* Only one of these conditions can be true */
>    Assert(during_backup_start ^
>           (sessionBackupState == SESSION_BACKUP_RUNNING));

It seems to me that the comment is true and the condition is a thinko.
This is introduced by df3737a651 so it is master only.

Please find the attached fix.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Avoid memory leaks during base backups
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Standby recovers records from wrong timeline