crdv7 opened a new pull request, #2433: URL: https://github.com/apache/age/pull/2433
Remove `pthread_mutex` from `age_global_graph.c` — it causes permanent self-deadlock on VLE queries. `ereport(ERROR)` (statement timeout, query cancellation, OOM, etc.) triggers `siglongjmp` which skips `pthread_mutex_unlock()`. The mutex remains locked, and every subsequent VLE query on the same backend hangs forever in `pthread_mutex_lock()` with `__owner == own PID`. Closes #2432 ## Analysis The mutex was introduced in PR #1881 (fix for #1878). It is both unnecessary and harmful: 1. **Unnecessary:** The protected variable is a process-local `static` — no concurrent access exists. The test failure in #1878 was a catalog-level race, already fixed by the Assert→runtime check and `strndup` in the same PR. For cross-backend cache invalidation, PostgreSQL syscache uses `sinval` callbacks, and PR #2376 already uses lock-free `pg_atomic_uint64` version counters in shared memory for this. 2. **Harmful:** `pthread_mutex` is incompatible with PostgreSQL's `ereport(ERROR)` / `siglongjmp` error handling. Any ERROR during the mutex-held window permanently locks it. This is the only use of `pthread` in the entire AGE codebase. ## Changes `src/backend/utils/adt/age_global_graph.c` (1 file, +13 −50): - Remove `#include <pthread.h>` - Remove `GRAPH_global_context_container` struct (with `pthread_mutex_t` field) - Revert to `static GRAPH_global_context *global_graph_contexts = NULL` - Remove all `pthread_mutex_lock/unlock` calls (20 references) The other fixes from PR #1881 (Assert→runtime check + `strndup`) remain untouched. ## Verification - All regression tests pass (36/36) - Deadlock reproduction via `statement_timeout`: no longer hangs after fix -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
