偶小梦
发布于

某些SELECT语句hang在getaddrinfo调用上

➢ 问题
在某些版本的 CentOS 7.x 上执行如下查询时可能导致执行 hang 住:

  create TEMP table tt (a int, b float4, c text);
insert into tt SELECT g, g, NULL from generate_series(1, 10000000)g;
    SELECT count(*) from tt where tt.c is null;

其错误的栈类似下面:

Thread 2 (Thread 0x7f1f03b26700 (LWP 4712)):
#0 0x00007f1eff58a69d in poll () from /lib64/libc.so.6
#1 0x0000000000bbf874 in rxThreadFunc (arg=<optimized out>) at ic_udpifc.c:6277
#2 0x00007f1f0008bdc5 in start_thread () from /lib64/libpthread.so.0
#3 0x00007f1eff594ced in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7f1f03bd8740 (LWP 4711)):
#0 0x00007f1eff595c5d in recvmsg () from /lib64/libc.so.6
#1 0x00007f1eff5b84cd in make_request () from /lib64/libc.so.6
#2 0x00007f1eff5b89c4 in __check_pf () from /lib64/libc.so.6
#3 0x00007f1eff57ea89 in getaddrinfo () from /lib64/libc.so.6
#4 0x0000000000bb9c81 in setupUDPListeningSocket (listenerSocketFd=0x2599a34, listenerPort=0x7fffcffb270c, txFamily=<optimized out>) at ic_udpifc.c:1231
#5 0x0000000000bbe8dd in startOutgoingUDPConnections (pOutgoingCount=<optimized out>, sendSlice=<optimized out>, transportStates=<optimized out>) at ic_udpifc.c:2987
#6 SetupUDPIFCInterconnect_Internal (estate=<optimized out>) at ic_udpifc.c:3460
#7 SetupUDPIFCInterconnect (estate=<optimized out>) at ic_udpifc.c:3521
#8 0x00000000007548fa in ExecutorStart (queryDesc=<optimized out>, eflags=<optimized out>) at execMain.c:517
#9 0x000000000099de15 in ProcessQuery (portal=<optimized out>, stmt=0x251a300, params=<optimized out>, dest=<optimized out>, completionTag=<optimized out>) at pquery.c:282
#10 0x000000000099ed19 in PortalRunMulti (portal=0x252c520, isTopLevel=1 '\001', dest=<optimized out>, altdest=<optimized out>, completionTag=0x7fffcffb2c90 "") at pquery.c:1603
#11 0x00000000009a0515 in PortalRun (portal=<optimized out>, count=<optimized out>, isTopLevel=0 '\000', dest=<optimized out>, altdest=<optimized out>, completionTag=<optimized out>) at pquery.c:1125
#12 0x00000000009994f3 in exec_mpp_query (localSlice=<optimized out>, seqServerPort=<optimized out>, seqServerHost=<optimized out>, serializedSliceInfolen=<optimized out>, serializedSliceInfo=<optimized out>, serializedParamslen=<optimized out>, serializedParams=<optimized out>, serializedPlantreelen=<optimized out>, serializedPlantree=<optimized out>, serializedQuerytreelen=<optimized out>, serializedQuerytree=<optimized out>, query_string=<optimized out>) at postgres.c:1358
#13 PostgresMain (argc=<optimized out>, argv=<optimized out>, dbname=0x2390788 "dsrprd", username=<optimized out>) at postgres.c:4905
#14 0x00000000008f7eae in BackendRun (port=<optimized out>) at postmaster.c:6963
#15 BackendStartup (port=<optimized out>) at postmaster.c:6658
#16 ServerLoop () at postmaster.c:2464
#17 0x00000000008fac30 in PostmasterMain (argc=15, argv=0x234b4a0) at postmaster.c:1540
#18 0x00000000007fccaf in main (argc=15, argv=0x234b430) at main.c:206
评论(3)
test