Repository navigation
Conversation
…ransaction (apache#2581) With age in shared_preload_libraries, post_parse_analyze runs for every statement, the ROLLBACK of a failed transaction included. When the caches of that backend were reset (the shared invalidation queue overflowed while it was not reading), the cached answer of is_age_extension_exists() is gone and get_extension_oid() misses the catcache: pg_extension and pg_class are opened in TBLOCK_ABORT, after the resource owner of the transaction was released. The locks are granted on the fast path and ResourceOwnerEnlarge() then fails ("called after release started"). Nothing releases those locks any more; the backend exits with them in its PGPROC, and every later backend on that PGPROC fails at connect with "failed to re-find shared lock object" until the server restarts. With --enable-cassert the same path trips Assert(IsTransactionState()) in AssertCouldGetRelation(). Return false outside a live transaction and cache nothing, so the next live transaction asks the catalog again. Only the statements that leave a failed transaction reach the parser there, and AGE has nothing to analyse in them. Fixes 2580. Co-authored-by: Konstantin Serikov <constse@gmail.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> (cherry picked from commit 06ce678)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #2581 (fixes #2580) to
PG18.#2581 is merged on
master, but PostgreSQL 18 users run AGE fromPG18(newest tagPG18/v1.8.0-rc0, theapache/age:release_PG18_1.8.0image), which does not carry it. On those servers the failure described in #2580 leavesPostgreSQL refusing new connections in every database (
FATAL: failed to re-find shared lock object) until it restarts.The change is #2581's commit, cherry-picked with
-x(06ce678). It applies cleanly toPG18(one file, +9; only the line offset differs).access/xact.his already included inag_catalog.con this branch.Tested on PostgreSQL 18.6 (
18.6-1.pgdg13+2, stockpostgres:18.6-trixie), AGE built from source as ininstallcheck.yaml(make COPT=-Werror install):PG18head (e43dc1a)COPT=-Werrormake installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"ROLLBACKs failed withResourceOwnerEnlarge called after release started, thenFATAL: failed to re-find shared lock objectand the client could not reconnectROLLBACKsucceeded, 30 of 30 new connections afterwards; the server logged only the statement timeoutsReproduction (a different shape from #2580's, same mechanism): AGE NOT in
shared_preload_libraries; two sessions runLOAD 'age', then loopBEGIN; SET LOCAL statement_timeout = '40ms'; SELECT * FROM cypher(...)with a variable-lengthmatch (
[:L*1..6], 1,000 vertices, 4,000 edges) that the timeout stops, thenROLLBACK. A third session in anotherdatabase loops plain
CREATE TABLE/CREATE INDEX/DROP TABLE(no AGE involved), which resets the other sessions'caches.
Controls from the same series on
PG18head (release_PG18_1.8.0image unless noted; the plain-DDL loop above unlessnoted), 60-90 s each:
temp_file_limitfailed itsROLLBACK98 of 138 times with AGEpreloaded, and 0 of 1,058 times on stock PostgreSQL 18.6 without AGE.
SELECT 1/0, AGE preloaded) failed 0 of 197,155ROLLBACKs, andsuccessful reads followed by
ROLLBACK0 of 121,317 (that run's DDL loop wascreate_graph/drop_graph).LOAD 'age'is enough: with AGE NOT preloaded, 98 of 112 failed — so leaving it out ofshared_preload_librariesdoes not avoid the failure.