I have a postgresql infinite problem.
when inserting data, a postgresql process involve to infinite loop and cpu
usage is 100%. perf top show that LWacquirelock is most costful.
Callstack is below.
Other processes are normal and can process insert operation.
But after some minutes, one another process involve to infinite loop.postgresql
I can reproduce the problem easily. About an hour, one of processes go into
abnormal process firstly
postgresql version is 9.2.15
postgresql is running in a container which os is centos 7.2.1511. Os of
physical machine is centos7.1.1503
#0 UnpinBuffer (buf=0x7fb47d11bdf8, fixOwner=) at bufmgr.c:1201
#1 0x0063947d in ReleaseAndReadBuffer (buffer=buffer@entry=2463,
relation=relation@entry=0x7fb47cc58f98, blockNum=423) at bufmgr.c:1089
#2 0x00482b6f in _bt_relandgetbuf (rel=rel@entry=0x7fb47cc58f98,
obuf=obuf@entry=2463, blkno=, access=access@entry=1) at
nbtpage.c:639
#3 0x004863d8 in _bt_moveright (rel=rel@entry=0x7fb47cc58f98,
buf=2463, keysz=keysz@entry=1, scankey=scankey@entry=0x178a350,
nextkey=nextkey@entry=0 '\000', access=access@entry=1)
at nbtsearch.c:194
#4 0x0048669f in _bt_search (rel=rel@entry=0x7fb47cc58f98,
keysz=keysz@entry=1, scankey=scankey@entry=0x178a350, nextkey=nextkey@entry=0
'\000', bufP=bufP@entry=0x7fff0e5f8064,
access=access@entry=2) at nbtsearch.c:86
#5 0x0048249f in _bt_doinsert (rel=rel@entry=0x7fb47cc58f98,
itup=itup@entry=0x1788200, checkUnique=checkUnique@entry=UNIQUE_CHECK_YES,
heapRel=heapRel@entry=0x7fb47cc581d8)
at nbtinsert.c:118
#6 0x0048520d in btinsert (fcinfo=) at nbtree.c:257
#7 0x00728cfa in FunctionCall6Coll (flinfo=flinfo@entry=0x1758040,
collation=collation@entry=0, arg1=arg1@entry=140413164162968,
arg2=arg2@entry=140733434529104,
arg3=arg3@entry=140733434529360, arg4=arg4@entry=24658596,
arg5=arg5@entry=140413164159448, arg6=1) at fmgr.c:1440
#8 0x0047f109 in index_insert
(indexRelation=indexRelation@entry=0x7fb47cc58f98,
values=values@entry=0x7fff0e5f8550, isnull=isnull@entry=0x7fff0e5f8650 "",
heap_t_ctid=heap_t_ctid@entry=0x17842a4,
heapRelation=heapRelation@entry=0x7fb47cc581d8,
checkUnique=checkUnique@entry=UNIQUE_CHECK_YES) at indexam.c:216
#9 0x0058db1d in ExecInsertIndexTuples (slot=slot@entry=0x1751b30,
tupleid=tupleid@entry=0x17842a4, estate=estate@entry=0x1750fc0) at
execUtils.c:1089
#10 0x0059adc7 in ExecInsert (canSetTag=1 '\001', estate=0x1750fc0,
planSlot=0x1751b30, slot=0x1751b30) at nodeModifyTable.c:248
#11 ExecModifyTable (node=node@entry=0x17511e0) at nodeModifyTable.c:854
#12 0x00584478 in ExecProcNode (node=node@entry=0x17511e0) at
execProcnode.c:376
#13 0x00581c40 in ExecutePlan (dest=0x176f238, direction=, numberTuples=0, sendTuples=0 '\000', operation=CMD_INSERT,
planstate=0x17511e0, estate=0x1750fc0) at execMain.c:1411
#14 standard_ExecutorRun (queryDesc=0x1758850, direction=,
count=0) at execMain.c:315
#15 0x0065e3ae in ProcessQuery (plan=,
sourceText=0x177ba80 "INSERT INTO token (id, expires, extra, valid,
user_id, trust_id) VALUES ('d810c3f542414cfa86778249be70ab93',
'2016-09-26T06:32:46.097976'::timestamp, '{\"token_data\": {\"token\":
{\"methods\": [\"password\"]"..., params=0x0, dest=0x176f238,
completionTag=0x7fff0e5f8c80 "") at pquery.c:185
#16 0x0065e5dd in PortalRunMulti (portal=portal@entry=0x1638380,
isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x176f238,
altdest=altdest@entry=0x176f238,
completionTag=completionTag@entry=0x7fff0e5f8c80 "") at pquery.c:1275
#17 0x0065f1a8 in PortalRun (portal=0x1638380,
count=9223372036854775807, isTopLevel=, dest=0x176f238,
altdest=0x176f238, completionTag=0x7fff0e5f8c80 "") at pquery.c:812
#18 0x0065b100 in PostgresMain (argc=, argv=, dbname=, username=) at postgres.c:1073
#19 0x006182c6 in BackendRun (port=0x163e9a0) at postmaster.c:3813
#20 BackendStartup (port=0x163e9a0) at postmaster.c:3484
#21 ServerLoop () at postmaster.c:1497
#22 0x00619077 in PostmasterMain (argc=argc@entry=1,
argv=argv@entry=0x1616690) at postmaster.c:1226
#23 0x0045bb45 in main (argc=1, argv=0x1616690) at main.c:230