Fix debug psql_trylock: missing strong override left lockctr unupdated

The weak psql_trylock() stub in psql.c called plocks_trywrlock() directly
without updating lockctr. In the debug build, psql_unlock() asserts
lockctr > 0, so when trylock succeeded (lock acquired, lockctr still 0)
the assert fired with SIGABRT on write ops via pfs_inc_writeid_locked.

Add a strong psql_trylock() override in psql_debug.c that delegates to
psql_do_trylock(), which properly acquires the rwlock and updates lockctr.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-03-09 20:42:49 +01:00
parent 53eff6a57b
commit f8dc321286
1 changed files with 4 additions and 0 deletions

View File

@ -227,6 +227,10 @@ void psql_do_rdlock(const char *file, unsigned line) {
// Strong overrides for same-named functions (weak in psql.c)
// --------------------------------------------------------------------------
int psql_trylock() {
return psql_do_trylock(__FILE__, __LINE__);
}
void psql_lock() {
psql_do_lock(__FILE__, __LINE__);
}