Re: Server crash (FailedAssertion) due to catcache refcount mis-handling
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-08-08T15:36:17Z
Lists: pgsql-hackers
Jeevan Chalke <jeevan.chalke@enterprisedb.com> writes: > We have observed a random server crash (FailedAssertion), while running few > tests at our end. Stack-trace is attached. > By looking at the stack-trace, and as discussed it with my team members; > what we have observed that in SearchCatCacheList(), we are incrementing > refcount and then decrementing it at the end. However for some reason, if > we are in TRY() block (where we increment the refcount), and hit with any > interrupt, we failed to decrement the refcount due to which later we get > assertion failure. Hm. So SearchCatCacheList has a PG_TRY block that is meant to release those refcounts, but if you hit the backend with a SIGTERM while it's in that function, control goes out through elog(FATAL) which doesn't execute the PG_CATCH cleanup. But it does do AbortTransaction which calls AtEOXact_CatCache, and that is expecting that all the cache refcounts have reached zero. We could respond to this by using PG_ENSURE_ERROR_CLEANUP there instead of plain PG_TRY. But I have an itchy feeling that there may be a lot of places with similar issues. Should we be revisiting the basic way that elog(FATAL) works, to make it less unlike elog(ERROR)? regards, tom lane
Commits
-
Handle elog(FATAL) during ROLLBACK more robustly.
- daafb11ff539 9.4.14 landed
- cd184273ba9d 9.3.19 landed
- 8ae41ceae82b 9.2.23 landed
- 624b6f328a1b 9.6.5 landed
- 5b6289c1e07d 10.0 landed
- 51684bad9fec 9.5.9 landed
-
Remove AtEOXact_CatCache().
- bb11ff2bc8af 9.3.19 landed
- a64b5a9927e9 9.6.5 landed
- 5a3688dc88ec 9.4.14 landed
- 5069017fecd2 9.2.23 landed
- 425be3ac900f 9.5.9 landed
- 004a9702e062 10.0 landed