From: Tomonari K. <kat...@po...> - 2013-06-12 08:56:42
|
Hi Ashutosh, Thank you for the response. (2013/06/12 14:43), Ashutosh Bapat wrote: >> Hi, >> > >> > I've investigated this problem(BUG:3614369). >> > >> > I caught the cause of it, but I can not >> > find where to fix. >> > >> > The problem occurs when "pgxc_collect_RTE_walker" is called infinitely. >> > It seems that rtable(List of RangeTable) become cyclic List. >> > I'm not sure where the List is made. >> > >> > > I guess, we are talking about EXECUTE DIRECT statement that you have > mentioned earlier. Yes, that's right. I'm talking about EXECUTE DIRECT statement like below. --- EXECUTE DIRECT ON (data1) $$ SELECT count(*) FROM (SELECT * FROM pg_locks l LEFT JOIN (SELECT * FROM pg_stat_activity) s ON l.database = s.datid) a $$ --- > The function pgxc_collect_RTE_walker() is a recursive > function. The condition to end the recursion is if the given node is NULL. > We have to look at if that condition is met and if not why. > I investigated it deeper, and I noticed that the infinitely loop happens at the function "range_table_walker()". Please see below trace. =========================== Breakpoint 1, range_table_walker (rtable=0x15e7968, walker=0x612c70 <pgxc_collect_RTE_walker>, context=0x7fffd2de31c0, flags=0) at nodeFuncs.c:1908 1908 in nodeFuncs.c (gdb) p *rtable $10 = {type = T_List, length = 5, head = 0x15e7998, tail = 0x15e9820} (gdb) p *rtable->head $11 = {data = {ptr_value = 0x15e79b8, int_value = 22968760, oid_value = 22968760}, next = 0x15e8190} (gdb) p *rtable->head->next $12 = {data = {ptr_value = 0x15e81b0, int_value = 22970800, oid_value = 22970800}, next = 0x15e8988} (gdb) p *rtable->head->next->next $13 = {data = {ptr_value = 0x15e89a8, int_value = 22972840, oid_value = 22972840}, next = 0x15e9018} (gdb) p *rtable->head->next->next->next $14 = {data = {ptr_value = 0x15e9038, int_value = 22974520, oid_value = 22974520}, next = 0x15e9820} (gdb) p *rtable->head->next->next->next->next $15 = {data = {ptr_value = 0x15e9840, int_value = 22976576, oid_value = 22976576}, next = 0x15e7998} =========================== The line which starts with "$15" has 0x15e7998 as its next data. But it is the head pointer(see the line which starts with $10). And in range_table_walker(), the function is called recursively. -------- ... if (!(flags & QTW_IGNORE_RANGE_TABLE)) { if (range_table_walker(query->rtable, walker, context, flags)) return true; } ... -------- We should make rtable right or deal with "flags" properly. But I can't find where to do it... What do you think ? regards, --------- NTT Software Corporation Tomonari Katsumata |