postgresql infinite loop

From: 郭 勇 <guoyongxhzhf(at)icloud(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: postgresql infinite loop
Date: 2016-09-29 13:12:59
Message-ID: F2FB5F15-562A-40B5-A62C-D5A20D072565@icloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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=<optimized out>) at bufmgr.c:1201
#1 0x000000000063947d in ReleaseAndReadBuffer (buffer=buffer(at)entry=2463, relation=relation(at)entry=0x7fb47cc58f98, blockNum=423) at bufmgr.c:1089
#2 0x0000000000482b6f in _bt_relandgetbuf (rel=rel(at)entry=0x7fb47cc58f98, obuf=obuf(at)entry=2463, blkno=<optimized out>, access=access(at)entry=1) at nbtpage.c:639
#3 0x00000000004863d8 in _bt_moveright (rel=rel(at)entry=0x7fb47cc58f98, buf=2463, keysz=keysz(at)entry=1, scankey=scankey(at)entry=0x178a350, nextkey=nextkey(at)entry=0 '\000', access=access(at)entry=1)
at nbtsearch.c:194
#4 0x000000000048669f in _bt_search (rel=rel(at)entry=0x7fb47cc58f98, keysz=keysz(at)entry=1, scankey=scankey(at)entry=0x178a350, nextkey=nextkey(at)entry=0 '\000', bufP=bufP(at)entry=0x7fff0e5f8064,
access=access(at)entry=2) at nbtsearch.c:86
#5 0x000000000048249f in _bt_doinsert (rel=rel(at)entry=0x7fb47cc58f98, itup=itup(at)entry=0x1788200, checkUnique=checkUnique(at)entry=UNIQUE_CHECK_YES, heapRel=heapRel(at)entry=0x7fb47cc581d8)
at nbtinsert.c:118
#6 0x000000000048520d in btinsert (fcinfo=<optimized out>) at nbtree.c:257
#7 0x0000000000728cfa in FunctionCall6Coll (flinfo=flinfo(at)entry=0x1758040, collation=collation(at)entry=0, arg1=arg1(at)entry=140413164162968, arg2=arg2(at)entry=140733434529104,
arg3=arg3(at)entry=140733434529360, arg4=arg4(at)entry=24658596, arg5=arg5(at)entry=140413164159448, arg6=1) at fmgr.c:1440
#8 0x000000000047f109 in index_insert (indexRelation=indexRelation(at)entry=0x7fb47cc58f98, values=values(at)entry=0x7fff0e5f8550, isnull=isnull(at)entry=0x7fff0e5f8650 "",
heap_t_ctid=heap_t_ctid(at)entry=0x17842a4, heapRelation=heapRelation(at)entry=0x7fb47cc581d8, checkUnique=checkUnique(at)entry=UNIQUE_CHECK_YES) at indexam.c:216
#9 0x000000000058db1d in ExecInsertIndexTuples (slot=slot(at)entry=0x1751b30, tupleid=tupleid(at)entry=0x17842a4, estate=estate(at)entry=0x1750fc0) at execUtils.c:1089
#10 0x000000000059adc7 in ExecInsert (canSetTag=1 '\001', estate=0x1750fc0, planSlot=0x1751b30, slot=0x1751b30) at nodeModifyTable.c:248
#11 ExecModifyTable (node=node(at)entry=0x17511e0) at nodeModifyTable.c:854
#12 0x0000000000584478 in ExecProcNode (node=node(at)entry=0x17511e0) at execProcnode.c:376
#13 0x0000000000581c40 in ExecutePlan (dest=0x176f238, direction=<optimized out>, numberTuples=0, sendTuples=0 '\000', operation=CMD_INSERT, planstate=0x17511e0, estate=0x1750fc0) at execMain.c:1411
#14 standard_ExecutorRun (queryDesc=0x1758850, direction=<optimized out>, count=0) at execMain.c:315
#15 0x000000000065e3ae in ProcessQuery (plan=<optimized out>,
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 0x000000000065e5dd in PortalRunMulti (portal=portal(at)entry=0x1638380, isTopLevel=isTopLevel(at)entry=1 '\001', dest=dest(at)entry=0x176f238, altdest=altdest(at)entry=0x176f238,
completionTag=completionTag(at)entry=0x7fff0e5f8c80 "") at pquery.c:1275
#17 0x000000000065f1a8 in PortalRun (portal=0x1638380, count=9223372036854775807, isTopLevel=<optimized out>, dest=0x176f238, altdest=0x176f238, completionTag=0x7fff0e5f8c80 "") at pquery.c:812
#18 0x000000000065b100 in PostgresMain (argc=<optimized out>, argv=<optimized out>, dbname=<optimized out>, username=<optimized out>) at postgres.c:1073
#19 0x00000000006182c6 in BackendRun (port=0x163e9a0) at postmaster.c:3813
#20 BackendStartup (port=0x163e9a0) at postmaster.c:3484
#21 ServerLoop () at postmaster.c:1497
#22 0x0000000000619077 in PostmasterMain (argc=argc(at)entry=1, argv=argv(at)entry=0x1616690) at postmaster.c:1226
#23 0x000000000045bb45 in main (argc=1, argv=0x1616690) at main.c:230

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-09-29 13:25:59 Re: postgresql infinite loop
Previous Message Kyotaro HORIGUCHI 2016-09-29 13:02:57 Re: WAL logging problem in 9.4.3?