Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBKK5-0005dV-26 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2017 12:14:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dBKK4-0003iv-L7 for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2017 12:14:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dBK4G-0003mB-94; Thu, 18 May 2017 11:58:08 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dBK4B-0003YF-Ov; Thu, 18 May 2017 11:58:06 +0000 Received: by mail-wm0-x241.google.com with SMTP id k15so9371629wmh.3; Thu, 18 May 2017 04:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=uMWtNlBfwKUwi4k4r1fSNoOc4jK5PRtAICqOJporrd4=; b=PrAQBWZD4NuioqdEO01VcwlUKvbRx+32FtUef+X1NTE7QVZUiH3Tna3qJpYtCk5ahQ +Pcons3TFvdc/FgS1V9rvjn86vQrMoBkukTKGQg3HEF0nlU2PY0hgulm773G457f04m3 0ddqy9n1c9NBPko6Zhn72bTNQLosjfvOz3U2DbS1eFusJt0mnqczl2fYSW5OMqasmm3P ML09+Ysvh694y7zwylIv7Vs1v5BKa2xpFgsdGbYds4nP36zcI14pH9/SM+WVq34Y2IvA 8n0RIYopVU1ZlrkmYZDyhzLj7iv5fr+VB/YIjqPc/wDpI8VtzY6pBk3ioJB/RB4pudHF zdNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=uMWtNlBfwKUwi4k4r1fSNoOc4jK5PRtAICqOJporrd4=; b=HqbLqw7ouaUjGVqQPKXCzGfvgD5o9VxhVGx0zlQE2pu3bz7xRnHk2UVa6D1bkZefVp o8N+Ynal7gl2R9wE1CXVl2Kh3ltbdkL8tN2WYdFJ7p8cb5YhEVbD/QSiI6+zWUMPudF/ zdyiEWvq0xfHM/Nda5Zt7Dfg75eoV313rJkdRsFTRgwkKHwSsFtIVuUF+Gi0ZjOGJrXS JqZr3rbmfZCiVbyG10geih0NCeEEq9Nwdg+kXVybVR+AeRb9+Ss5la3Oz+CSGY5XXnvD onoPoB/HFjVsx/Cb9S6kDbaXLe8cHpI65ZwelPBVDvD0D+sRsXHqkHLGUtTSfLJc/BEB fr7Q== X-Gm-Message-State: AODbwcAopXHzc8VB/og7nzqAOOAX9iuaI/vx96DzjLWAjenaR+KbqcAW SNVkPzdA4CcfpA== X-Received: by 10.80.174.99 with SMTP id c90mr2973154edd.136.1495108682081; Thu, 18 May 2017 04:58:02 -0700 (PDT) Received: from [172.25.111.7] (66-99-22-46.business.hringdu.is. [46.22.99.66]) by smtp.googlemail.com with ESMTPSA id c47sm2001161ede.32.2017.05.18.04.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2017 04:58:00 -0700 (PDT) Subject: Re: [BUGS] BUG #14657: Server process segmentation fault in v10, May 10th dev snapshot To: Amit Langote , Dilip Kumar References: <20170517141151.1435.79890@wrigleys.postgresql.org> <6b2fb5ff-40e1-fda3-3ce5-6723e9e5df61@lab.ntt.co.jp> Cc: pgsql-bugs@postgresql.org, Pg Hackers From: Sveinn Sveinsson Message-ID: <65cbe70a-7be4-dad8-ef44-f268c82b579e@gmail.com> Date: Thu, 18 May 2017 11:57:59 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <6b2fb5ff-40e1-fda3-3ce5-6723e9e5df61@lab.ntt.co.jp> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org The patch fixed the problem, thanks a lot. Regards, Sveinn. On fim 18.maĆ­ 2017 01:53, Amit Langote wrote: > On 2017/05/18 10:49, Amit Langote wrote: >> On 2017/05/18 2:14, Dilip Kumar wrote: >>> On Wed, May 17, 2017 at 7:41 PM, wrote: >>>> (gdb) bt >>>> #0 0x000000000061ab1b in list_nth () >>>> #1 0x00000000005e4081 in ExecLockNonLeafAppendTables () >>>> #2 0x00000000005f4d52 in ExecInitMergeAppend () >>>> #3 0x00000000005e0365 in ExecInitNode () >>>> #4 0x00000000005f35a7 in ExecInitLimit () >>>> #5 0x00000000005e00f3 in ExecInitNode () >>>> #6 0x00000000005dd207 in standard_ExecutorStart () >>>> #7 0x00000000006f96d2 in PortalStart () >>>> #8 0x00000000006f5c7f in exec_simple_query () >>>> #9 0x00000000006f6fac in PostgresMain () >>>> #10 0x0000000000475cdc in ServerLoop () >>>> #11 0x0000000000692ffa in PostmasterMain () >>>> #12 0x0000000000476600 in main () >> Thanks for the test case Sveinn and thanks Dilip for analyzing. >> >>> Seems like the issue is that the plans under multiple subroots are >>> pointing to the same partitioned_rels. >> That's correct. >> >>> If I am not getting it wrong "set_plan_refs(PlannerInfo *root, Plan >>> *plan, int rtoffset)" the rtoffset is specific to the subroot. Now, >>> problem is that set_plan_refs called for different subroot is updating >>> the same partition_rel info and make this value completely wrong which >>> will ultimately make ExecLockNonLeafAppendTables to access the out of >>> bound "rte" index. >> Yes. >> >>> set_plan_refs >>> { >>> [clipped] >>> case T_MergeAppend: >>> { >>> [clipped] >>> >>> foreach(l, splan->partitioned_rels) >>> { >>> lfirst_int(l) += rtoffset; >>> >>> >>> I think the solution should be that create_merge_append_path make the >>> copy of partitioned_rels list? >> Yes, partitioned_rels should be copied. >> >>> Attached patch fixes the problem but I am not completely sure about the fix. >> Thanks for creating the patch, although I think a better fix would be to >> make get_partitioned_child_rels() do the list_copy. That way, any other >> users of partitioned_rels will not suffer the same issue. Attached patch >> implements that, along with a regression test. >> >> Added to the open items. > Oops, forgot to cc -hackers. Patch attached again. > > Thanks, > Amit -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers