Re: [HACKERS] [TRAP: FailedAssertion] causing server to crash - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [HACKERS] [TRAP: FailedAssertion] causing server to crash
Date
Msg-id CAMsr+YGyMVw-3LF_6gGQCfuMR6_KkGP+VmAkNGe=oFhZA0W06g@mail.gmail.com
Whole thread Raw
In response to [HACKERS] [TRAP: FailedAssertion] causing server to crash  (Neha Sharma <neha.sharma@enterprisedb.com>)
Responses Re: [HACKERS] [TRAP: FailedAssertion] causing server to crash
List pgsql-hackers
On 19 July 2017 at 20:26, Neha Sharma <neha.sharma@enterprisedb.com> wrote:
Hi,

I am getting FailedAssertion while executing the attached script.However,I am not able to produce the core dump for the same,the script runs in background and takes around a day time to produce the mentioned error.

"TRAP: FailedAssertion("!(TransactionIdPrecedesOrEquals(oldestXact, ShmemVariableCache->oldestXid))", File: "clog.c", Line: 683)
2017-07-19 01:16:51.973 GMT [27873] LOG:  server process (PID 28084) was terminated by signal 6: Aborted
2017-07-19 01:16:51.973 GMT [27873] DETAIL:  Failed process was running: autovacuum: VACUUM pg_toast.pg_toast_13029 (to prevent wraparound)"

It's not much of a stretch to assume this was likely introduced by ea42cc18c:


so I'll have a look to see if I can spot how it could happen.

Please show your "SELECT version()" and if using a build from git, the "git rev-parse --short HEAD" for the build you're running.

It's interesting and probably significant that your Pg was nearing wraparound. Just a tip for that - if you want to create a situation where you near wraparound quickly and easily, for testing, you can, on a test instance you don't care about:

- select txid_current();
- stop pg
- pg_resetxlog -n $(( $the_xid + (1<<31) - 1001000 ))
- try to start pg, note the missing clog segment it complains about
- dd if=/dev/zero bs=1 count=262144 of=datadir/pg_clog/$MISSINGSEGNAME
- start Pg


That should put you about 1000 txn's from the 1 million xid limit, assuming I got my maths right (don't assume that), and assuming your starting xid is well short of the 2-million mark.


--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [HACKERS] Dealing with logical replication
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] <> join selectivity estimate question