[Postgres-xl-developers] Leaking killed clients processes because of WaitLatchOrSocket?

Krzysztof Nienartowicz krzysztof.nienartowicz at unige.ch
Tue Oct 20 07:58:50 PDT 2015


There is a process leak when client performing COPY is killed: all backend
processes stay there ad infinitum in our case.

This is directly related to this:
http://www.postgresql.org/message-id/18967.1336873681@sss.pgh.pa.us

Since POLLHUP is intercepted as read and causes infinite loop, all
associated COPY processes are staying alive as well. 'clean all
connections..' is killing them usually but this is similar to cluster
restart, so no a good solution.

Seems Postgres does not solve this and in the XL/X2 case this is multiplied
by the datanode processes some solution for this would be welcome.

Do you know why:

https://github.com/yazun/postgres-xl/blob/master/src/backend/port/unix_latch.c#L368

is not intercepted at all?
I presume next read should return EOF, but it does not happen.
In our case it just loops or poll is not returning after the client
disappearance - I am not sure.

Any hints if/how this could be fixed?

Krzysztof

#0  0x00007f9dc3559b60 in __poll_nocancel () from /lib64/libc.so.6
#1  0x00000000007f0e9e in WaitLatchOrSocket (latch=0x7f9daa3752fc,
wakeEvents=wakeEvents at entry=3, sock=10, timeout=timeout at entry=0) at
pg_latch.c:333
#2  0x0000000000487031 in secure_read (port=0x14e06c0, ptr=0xd0db80
<PqRecvBuffer.182942.13138>, len=65536) at be-secure.c:153
#3  0x00000000004872fc in pq_recvbuf () at pqcomm.c:887
#4  pq_getbytes (s=0x7f9a8bcc326d
"0,0,0,-16676,22186,-15022,6682,-542,909,-1091,2556,-1089,464,-198,84,-36,15,-6,3,-1,0,0,0,0,-16671,22218,-14963,1252,-2098,2519,-5909,2524,-1076,459,-194,82,-35,15,-6,2,-1,0,0,0,-16714,22165,-2766,464"...,
    len=4107731) at pqcomm.c:1028
#5  0x00000000004874c0 in pq_getmessage (s=0x161bda0, maxlen=maxlen at entry=0)
at pqcomm.c:1251
#6  0x000000000056cd83 in CopyGetData (maxread=<optimized out>, minread=1,
databuf=<optimized out>, cstate=0x15d5498) at copy.c:660
#7  CopyLoadRawBuf (cstate=0x15d5498) at copy.c:814
#8  CopyReadLineText (cstate=0x15d5498) at copy.c:3841
#9  CopyReadLine (cstate=cstate at entry=0x15d5498) at copy.c:3687
#10 0x000000000056d5c5 in NextCopyFromRawFields (cstate=cstate at entry=0x15d5498,
fields=fields at entry=0x7ffe9a517680, nfields=nfields at entry=0x7ffe9a517660)
at copy.c:3239
#11 0x000000000056df45 in NextCopyFrom (cstate=cstate at entry=0x15d5498,
econtext=econtext at entry=0x1604fd0, values=values at entry=0x162cae0,
nulls=nulls at entry=0x15d5f38 '\001' <repeats 86 times>,
tupleOid=tupleOid at entry=0x7ffe9a5177c0)
    at copy.c:3308
#12 0x000000000056ef4c in CopyFrom (cstate=0x15d5498) at copy.c:2589
#13 DoCopy (stmt=stmt at entry=0x15c3bf0, queryString=queryString at entry=0x15c2f90
"copycs FROM STDOUT with DELIMITER as ';'",
processed=processed at entry=0x7ffe9a5179a0)
at copy.c:1017
#14 0x0000000000570423 in standard_ProcessUtility (parsetree=0x15c3bf0,
queryString=0x15c2f90 "copy cs FROM STDOUT with DELIMITER as ';'",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0,
    dest=0x15c3f50, sentToRemote=<optimized out>,
completionTag=0x7ffe9a517e20 "") at utility.c:728
#15 0x00000000007a6890 in PortalRunUtility (portal=0x15c8fc0,
utilityStmt=0x15c3bf0, isTopLevel=<optimized out>, dest=0x15c3f50,
completionTag=0x7ffe9a517e20 "") at pquery.c:1689
#16 0x00000000007a6d29 in PortalRunMulti (portal=portal at entry=0x15c8fc0,
isTopLevel=isTopLevel at entry=1 '\001', dest=dest at entry=0x15c3f50,
altdest=<optimized out>, altdest at entry=0x15c3f50,
completionTag=completionTag at entry=0x7ffe9a517e20 "")
    at pquery.c:1836
#17 0x00000000007a7597 in PortalRun (portal=portal at entry=0x15c8fc0,
count=count at entry=9223372036854775807, isTopLevel=isTopLevel at entry=1
'\001', dest=dest at entry=0x15c3f50, altdest=altdest at entry=0x15c3f50,
    completionTag=completionTag at entry=0x7ffe9a517e20 "") at pquery.c:1109
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.postgres-xl.org/private.cgi/postgres-xl-developers-postgres-xl.org/attachments/20151020/e6570642/attachment.htm>


More information about the Postgres-xl-developers mailing list