Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDRM8-0003s8-Kj for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Sep 2019 10:50:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDRM7-00029d-IB for pgsql-bugs@arkaria.postgresql.org; Thu, 26 Sep 2019 10:50:39 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDGbj-0006kI-16 for pgsql-bugs@lists.postgresql.org; Wed, 25 Sep 2019 23:22:03 +0000 Received: from mout.gmx.net ([212.227.17.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDGbg-0001sI-6J for pgsql-bugs@lists.postgresql.org; Wed, 25 Sep 2019 23:22:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1569453711; bh=LQEWoNJbXt+fZjuo87jKCe5KmlZbt43MTN9cqpPZJ4k=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=P/T4W7cufUlAJImZVHVwB9hQQhG/cmasCTXULuD95M3oRikl7U05cxNiRoUGTwdLU utqg6TerlIQ1E6niElqLF+9zE6V0g3yviOJ9zWdNfM+WvPQLmMij+hLGnjZttO59/H L4Lzolrc3bbusCSlal/FlsAYPUz2BrUk+DXnGpLY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.178.22] ([89.246.12.149]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhD2Y-1hhlHB35hi-00eMKK; Thu, 26 Sep 2019 01:21:51 +0200 Subject: Re: BUG #16024: segfault ip 0000560103865c60 error 4 in postgres To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org References: <16024-840f55822dee2e9b@postgresql.org> <28993.1569451537@sss.pgh.pa.us> From: Stephan Knauss Message-ID: <7e355f85-508a-314f-e655-2d6107074e2e@gmx.de> Date: Thu, 26 Sep 2019 01:21:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <28993.1569451537@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:RKOrSiXZ8vHcn1Ta8iMr6adIPdJrB7NNwHzIFr5UDFCGBMTdT+C HIrEUlPAwQU4UXkIVX/JeSJQoK5+4evaQgEtrhBvhpPuxLlamqv+UGoIhLBXcc9kkPaIwck KzVP1WdxfKVxCnTrRSzeF3LzInDF1AFmLaeTbz4cSYhGiKWfy+oAxCccZLyD3M0yEdJLdKr X2L3p+/0zzlAdbZ9krX+A== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:gztuluj1zuI=:03fxII4M6TfSmto8BjfS3X ZzDQtzT7f6spQHQjWoixry6egbw6pI/OofAz0lB3Rp42aZUoUsHruF4VSFvR+/YOaG3Jikku8 nATKeWZ3WQVdKJxd4J+ox9Y5j3T0kr4SDcG5rGf1FvVrmUFDYvUnPerz998e/7YjpWzNX8P5A sXYlj75BdFG6E9DSRLd7O13gvatPrLNjQ9Zx9Wdu57YyfuPj5iIYyEaARshFwKJxwS57cWXy+ WM+ExPM8f9UfDDViuKidm2dR7hZTZ0Rewz8fFoHHmeZWOjd6rr63eYNy3XhG/RAHJ35bVJRuV B1a2G6fljT8WmHX6yS0G3FrsPBWrpQdAMXv0DnXZlwBr3S6lf6SSQI/SMKfYRERPxDQrdYCv6 tLO7XOkNww/VZoJo/hO2Kt913ZOWW9L/tF5y+VrDdaEJAYnsu3+q+6CjxTp5xdkSYUsMFiCc8 2Eu343SfBHMQKxgORnhdK6c2WYlN2H6LviCviA/I+d3kDJFXB84fB1VjedYsfEhpgYNXF4uOA lFhaV7W8deOZqjceRvj2IaoNGW+4oPhEjZUDui/lsGGnSHXPxEfH78gZSbBn7VZkcBOVD1G0t 0rK2NCPVckw6clMQ9AhRFe3zhTQXBy6Z+my6Mb/mMsYpFuTgPbdQ6CeELmpKhFtXXNqNbtDSW id+OZkvNxdnjHoh2GU5Dm1G7QoDDs9F+KeR61vydNXhOlvp+z+hcPRH19FNOthjcYbgn7tPJk RFX5+vcVHX6Um0ZhscU7zCEGrw4/GndyLZq3V8bkSMg+iAWrjp8wi9MuiooREODrnWc93KgIM +pInMMMdWPcSbw5W9xxOcUf6uEdcf5TnqqSJHomAwAkItgFaRF81YSZvAewgU8KoppbaiTi3e 2tfx0HzB457LLcQfOvnvil6lY8QD0NY4EmZSKRI2LStdEb3/OdePhIGV4dao7qfLyrsoMhMfL oUFRxYUe7ugewozSkqUW31sCPmwx37b4WnsOmiP1FfAIxZy8mLaDbnOTEAvvZLJvTrJvZLD44 b15bFMmgZRopVXYRajlS3GK2vRr20YLGfRLsChprgTL6SyvmJiufgc959NSj5AaqMLcmjpfsM pqW/IYr9+bpYu4H67JDgnuCYKPSkdMqe60atj6cb6quIjZWZxksHvJz8NIlcEXdNs7yOka0lO l5E5nYrclGkSNqwVSUhFbVFaLD40ZJ6VrR6y4z6q2XW+QdnrXVZ7A63Ye+8hEMNCxLfyflwnE GUEo7djoqc3yr8g5Tmk219dBa7ai37nM6ejngjg== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Tom, thank you for the quick reply. On 26.09.2019 00:45, Tom Lane wrote: > PG Bug reporting form writes: > A self-contained test case would be much handier. The stack trace > provides a suggestive hint about what you're doing: I fully agree on that. Unfortunately I have no idea what actually breaks. The query was running unchanged for quite a while now. It creates statistics for OpenStreetMap data a few times a day. It could either be that the input data has changed in a way now triggering a bug in postgres or that one of the recent updates broke it. I do update from the official postgresql repository. So I can't come up with a small repro case. I could dump the full DB. >> #15 0x0000564007ab5455 in exec_simple_query (query_string=3D0x5640089ed= 678 >> "DROP TABLE if EXISTS loose;CREATE UNLOGGED TABLE loose (id bigint, nod= e >> bigint, lat float, lon float, x integer, y integer);INSERT INTO loose S= ELECT >> id, nodes[1] AS node FROM planet_osm_ways WHERE ARR"...) >> at ./build/../src/backend/tcop/postgres.c:1109 > > but that's not enough to reproduce the problem. The full query is: $sql =3D "DROP TABLE if EXISTS loose;"; $sql .=3D "CREATE UNLOGGED TABLE loose (id bigint, node bigint, lat float, lon float, x integer, y integer);"; $sql .=3D "INSERT INTO loose SELECT id, nodes[1] AS node FROM planet_osm_ways WHERE ARRAY['motorway','trunk','primary','secondary','tertiary'] && tags AND NOT ARRAY['construction','proposed'] && tags AND nodes[1] <> nodes[array_upper(nodes, 1)];"; $sql .=3D "INSERT INTO loose SELECT id, nodes[array_upper(nodes, 1)] AS node FROM planet_osm_ways WHERE ARRAY['motorway','trunk','primary','secondary','tertiary'] && tags AND NOT ARRAY['construction','proposed'] && tags AND nodes[1] <> nodes[array_upper(nodes, 1)];"; $sql .=3D "DELETE FROM loose AS l WHERE (SELECT count(1) FROM planet_osm_ways AS w WHERE w.nodes && ARRAY[l.node] ) > 1;"; $sql .=3D "DELETE FROM loose AS l WHERE 0=3D(SELECT COUNT(1) FROM planet_osm_nodes AS n WHERE n.id=3Dl.node);"; $sql .=3D "DELETE FROM loose AS l USING planet_osm_point AS p WHERE p.osm_id =3Dl.node AND p.tags->'noexit' =3D 'yes';"; $sql .=3D "UPDATE loose AS l SET lat=3D(n.lat/10000000::float), lon=3D(n.lon/10000000::float), x=3DFLOOR( ((n.lon/10000000::float)+180)/360*(1<<19) )::integer, y=3DFLOOR( (1.0-ln(tan(radians((n.lat/10000000::float)))+1.0/cos(radians((n.lat/10000= 000::float))))/pi())/2.0*(1<<19) )::integer FROM planet_osm_nodes AS n WHERE n.id=3Dl.node;"; $sql .=3D "DELETE FROM loose AS l using planet_osm_nodes AS n WHERE n.id=3Dl.node AND NOT ST_Within(ST_SetSRID(ST_POINT(n.lon/10000000::float, n.lat/10000000::float), 4326), st_transform((select st_transform(st_union(way),4326) as w FROM planet_osm_polygon where osm_id=3D'-2067731' or osm_id=3D'-49903' or osm_id=3D'-50371' or osm_id=3D'-49915' or osm_id=3D'-49898' or osm_id=3D'-2108121' or osm_id=3D'-536780' or osm_id=3D'-2103120'), 4326));"; > Note that in psql, the way to submit a multi-query string like that > is to backslash-escape all but the last semicolon: > > DROP TABLE if EXISTS loose\;CREATE UNLOGGED ... y integer)\;INSERT INTO = ... > > That might be necessary to reproduce the problem, or not. I am not sure what you try to say. I am quite confident that I can separate individual commands in the query with a semicolon. It also worked quite well in the past and seems to be backed by the documentation: https://www.postgresql.org/docs/9.6/sql-syntax-lexical.html What do you mean by backslash-escaping? Or are you referring to the psql command line utility? This is not used in my case. I submit the query from PHP. But it sounds unrelated to me. Based on the call-stack is looks crashing way more inside some processing routines. Anything else I can support you tracking down this crash? Stephan