Obviously we should actually fix this on back branches, but could we at least make the retry loop interruptible in some way so people could use pg_cancel/terminate_backend() on a stuck autovacuum worker or vacuum process?
If the problem happens in versions <= PG 16, we don't have a good solution (vacuum process holds the exclusive lock cause checkpoint hangs).
Maybe we can make the retry loop interruptible first. However, since we are using START_CRIT_SECTION, we cannot simply use CHECK_FOR_INTERRUPTS to handle it.