On 24/08/16 17:01, Mark Kirkwood wrote:


...actually I was wrong there, only 2 of them were the same. So I've attached a new log of bt's of them all.




And I can reproduce with only 1 session, figured that might be a helpful piece of the puzzle (trace attached).


$ pgbench -c 1 -T600 bench

bench=# SELECT pid,state,now()-xact_start AS 
wait,wait_event_type,wait_event,query FROM pg_stat_activity WHERE 
datname='bench' ORDER BY wait DESC;
  pid  | state  |      wait       | wait_event_type |   wait_event   |          
         
                                                query                           
         
                                
-------+--------+-----------------+-----------------+----------------+-------------------
-----------------------------------------------------------------------------------------
--------------------------------
 17266 | active | 00:45:23.027555 | LWLockTranche   | buffer_content | INSERT 
INTO pgbenc
h_history (tid, bid, aid, delta, mtime) VALUES (352, 76, 1305123, -1604, 
CURRENT_TIMESTAM
P);
(1 row)

$ gdb -p 17266 
(gdb) bt
#0  0x00007f7b4d533387 in semop () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000000000660331 in PGSemaphoreLock (sema=sema@entry=0x7f7b4cad1690)
    at pg_sema.c:387
#2  0x00000000006bde9b in LWLockAcquire (lock=0x7f7b44583fe4, mode=LW_EXCLUSIVE)
    at lwlock.c:1288
#3  0x000000000049a625 in _hash_getbuf_with_strategy 
(rel=rel@entry=0x7f7b4e0c1908, 
    blkno=blkno@entry=12, access=access@entry=2, flags=flags@entry=1, 
    bstrategy=bstrategy@entry=0x0) at hashpage.c:252
#4  0x0000000000498040 in _hash_freeovflpage (rel=rel@entry=0x7f7b4e0c1908, 
    bucketbuf=bucketbuf@entry=12796, ovflbuf=ovflbuf@entry=236, 
wbuf=wbuf@entry=13166, 
    itups=itups@entry=0x7ffc693fc800, 
itup_offsets=itup_offsets@entry=0x13067d0, 
    tups_size=0x7ffc693fd4c0, nitups=34, bstrategy=0x0) at hashovfl.c:517
#5  0x0000000000499985 in _hash_squeezebucket (rel=rel@entry=0x7f7b4e0c1908, 
    bucket=bucket@entry=7, bucket_blkno=bucket_blkno@entry=10, 
    bucket_buf=bucket_buf@entry=12796, bstrategy=bstrategy@entry=0x0) at 
hashovfl.c:1010
#6  0x0000000000496caf in hashbucketcleanup (rel=rel@entry=0x7f7b4e0c1908, 
    bucket_buf=bucket_buf@entry=12796, bucket_blkno=bucket_blkno@entry=10, 
    bstrategy=bstrategy@entry=0x0, maxbucket=22, highmask=31, lowmask=15, 
    tuples_removed=0x0, num_index_tuples=0x0, bucket_has_garbage=1 '\001', 
    delay=0 '\000', callback=0x0, callback_state=0x0) at hash.c:937
#7  0x000000000049b353 in _hash_expandtable (rel=rel@entry=0x7f7b4e0c1908, 
    metabuf=metabuf@entry=6179) at hashpage.c:785
#8  0x0000000000497bae in _hash_doinsert (rel=rel@entry=0x7f7b4e0c1908, 
    itup=itup@entry=0x13060b8) at hashinsert.c:313
#9  0x000000000049617f in hashinsert (rel=0x7f7b4e0c1908, values=<optimized 
out>, 
    isnull=<optimized out>, ht_ctid=0x1305f7c, heapRel=<optimized out>, 
    checkUnique=<optimized out>) at hash.c:247
#10 0x00000000005bf060 in ExecInsertIndexTuples (slot=slot@entry=0x1304a70, 
    tupleid=tupleid@entry=0x1305f7c, estate=estate@entry=0x13043b0, 
    noDupErr=noDupErr@entry=0 '\000', specConflict=specConflict@entry=0x0, 
    arbiterIndexes=arbiterIndexes@entry=0x0) at execIndexing.c:388
#11 0x00000000005dd011 in ExecInsert (canSetTag=1 '\001', estate=0x13043b0, 
    onconflict=<optimized out>, arbiterIndexes=0x0, planSlot=0x1304a70, 
slot=0x1304a70, 
    mtstate=0x1304600) at nodeModifyTable.c:481
#12 ExecModifyTable (node=node@entry=0x1304600) at nodeModifyTable.c:1496
#13 0x00000000005c3948 in ExecProcNode (node=node@entry=0x1304600) at 
execProcnode.c:396
#14 0x00000000005bfdbf in ExecutePlan (dest=0x12f4bd8, direction=<optimized 
out>, 
    numberTuples=0, sendTuples=<optimized out>, operation=CMD_INSERT, 
    use_parallel_mode=<optimized out>, planstate=0x1304600, estate=0x13043b0)
    at execMain.c:1567
#15 standard_ExecutorRun (queryDesc=0x1303fa0, direction=<optimized out>, 
count=0)
    at execMain.c:338
#16 0x00000000006ce669 in ProcessQuery (plan=<optimized out>, 
    sourceText=0x12ccf50 "INSERT INTO pgbench_history (tid, bid, aid, delta, 
mtime) VALUES (352, 76, 1305123, -1604, CURRENT_TIMESTAMP);", params=0x0, 
dest=0x12f4bd8, 
    completionTag=0x7ffc69400c30 "") at pquery.c:187
#17 0x00000000006ce89c in PortalRunMulti (portal=portal@entry=0x1271fe0, 
    isTopLevel=isTopLevel@entry=1 '\001', 
    setHoldSnapshot=setHoldSnapshot@entry=0 '\000', dest=dest@entry=0x12f4bd8, 
---Type <return> to continue, or q <return> to quit---
    altdest=altdest@entry=0x12f4bd8, 
    completionTag=completionTag@entry=0x7ffc69400c30 "") at pquery.c:1303
#18 0x00000000006cf34e in PortalRun (portal=portal@entry=0x1271fe0, 
    count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=1 
'\001', 
    dest=dest@entry=0x12f4bd8, altdest=altdest@entry=0x12f4bd8, 
    completionTag=completionTag@entry=0x7ffc69400c30 "") at pquery.c:815
#19 0x00000000006cc45b in exec_simple_query (
    query_string=0x12ccf50 "INSERT INTO pgbench_history (tid, bid, aid, delta, 
mtime) VALUES (352, 76, 1305123, -1604, CURRENT_TIMESTAMP);") at postgres.c:1094
#20 PostgresMain (argc=<optimized out>, argv=argv@entry=0x1253a00, 
    dbname=0x1253930 "bench", username=<optimized out>) at postgres.c:4074
#21 0x000000000046d509 in BackendRun (port=0x12766c0) at postmaster.c:4262
#22 BackendStartup (port=0x12766c0) at postmaster.c:3936
#23 ServerLoop () at postmaster.c:1693
#24 0x000000000066fb91 in PostmasterMain (argc=argc@entry=1, 
argv=argv@entry=0x1252b30)
    at postmaster.c:1301
#25 0x000000000046e2b0 in main (argc=1, argv=0x1252b30) at main.c:228
(gdb) 

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to