Hello hackers, While stress-testing REPACK CONCURRENTLY on 19beta2 I saw a logical decoding activation race, and I extended 051_effective_wal_level.pl with a test that waits on an injection point and wakes it up later. 051 cancels two injection point waiters earlier in the script, and injection_wait() never cleans up after a canceled waiter, the wakeup never arrived and the test deadlocked.
I think we are missing an ENSURE_ERROR_CLEANUP block there. See attached patch with a testcase reproducing the issue. A wakeup racing against a canceled waiter with no other live waiter now errors with "could not find injection point ... to wake up" instead of silently bumping the leaked slot. I also attached a separate version for pg19, as master has a refactored version of injection_wait. All previous branches have the 19 version, it should be easy to backport to other branches.
nocfbot-pg19-0001-injection_points-clear-waiter-slot-on-error-and-exit.patch
Description: Binary data
0001-injection_points-clear-waiter-slot-on-error-and-exit.patch
Description: Binary data
