pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.12k stars 364 forks source link

AssertFailedException: edges (2.4.0) #769

Closed denadai2 closed 7 years ago

denadai2 commented 7 years ago

Before proceeding, I know that the query is very complex AND I know I didn't share the data yet, but maybe there is a solution before doing it (because I don't understand what the error is). So can you explain me the error and if there is a bug by chance? If so, I can share the data but it will be long :D

Expected behavior and actual behavior

ERROR:  AssertFailedException: edges at /data/nadai/pgrouting-2.4.0/src/withPoints/src/many_to_many_withPoints_driver.cpp:111
*** Execution path***
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/libpgrouting-2.4.so(_Z13get_backtraceB5cxx11v+0x2e) [0x7f1bbd1b409c]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/libpgrouting-2.4.so(do_pgr_many_to_many_withPoints+0x3bc) [0x7f1bbd38c8b7]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/libpgrouting-2.4.so(+0x62b575) [0x7f1bbd383575]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/libpgrouting-2.4.so(one_to_many_withPoints+0x16b) [0x7f1bbd383839]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW(ExecMakeTableFunctionResult+0x165) [0x5bbed5]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW() [0x5d1553]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW(ExecScan+0x192) [0x5bdda2]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW(ExecProcNode+0x1c8) [0x5b7118]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW(standard_ExecutorRun+0x14f) [0x5b35df]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW() [0x6bcaf7]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW(PortalRunFetch+0x128) [0x6be128]
[bt]postgres: nadai vv_la [local] CREATE MATERIALIZED VIEW() [0x5db91e]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/plpgsql.so(+0x17117) [0x7f1bbd6bf117]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/plpgsql.so(+0x1981b) [0x7f1bbd6c181b]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/plpgsql.so(plpgsql_exec_function+0x1a3) [0x7f1bbd6c1a23]
[bt]/data/nadai/compiled/postgresql-9.6.1/lib/plpgsql.so(plpgsql_call_handler+0xac) [0x7f1bbd6b6c7c]

HINT:
CONTEXT:  PL/pgSQL function pgr_withpointscost(text,text,bigint,anyarray,boolean,character) line 3 at RETURN QUERY

Steps to reproduce the problem

The query finds all the distances between each way and its neighbouring ways. The neighbouring ways are contained in ways_nears. I use the replace to select a subset of ways and POIs (which are ways too) for each request.

select -1*r.start_pid as way1, -1*r.end_pid as way2, r.cost from ways_nears n
inner join lateral (
    select start_pid, end_pid, agg_cost as cost from pgr_withPointsCost(
        replace('SELECT s.gid as id, s.source, s.target, s.length_m as cost, s.x1,s.y1,s.x2,s.y2 FROM ways s inner join ways w on st_dwithin(s.the_geom, w.the_geom, 0.015) where w.gid = {starting}'::text, '{starting}'::text, n.way1::text), 
        REPLACE(REPLACE('SELECT j.way_id as pid, j.way_id as edge_id, j.fraction from buildings_on_ways j where j.way_id = {starting} OR -1*j.way_id = ANY(ARRAY[{ending}])'::text, '{starting}'::text, n.way1::text), '{ending}'::text, array_to_string(n.ways, ',', '*')), 
        way1_n, n.ways, false)) r 
    on n.way1_n = r.start_pid;

Specifications like the version of pgRouting/PostGIS and PostgreSQL as well as Operating System

PostgreSQL 9.6.1 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit

POSTGIS="2.3.0 r15146" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.9.2, 08 September 2015" GDAL="GDAL 1.11.3, released 2015/09/16" LIBXML="2.9.1" RASTER

(2.4.0,v2.4.0,6cf07edf1,master,1.54.0)
cvvergara commented 7 years ago

@denadai2 You compiled as DEBUG so all assertions are on, so the bunch of lines are the trace of the execution. So, I think that all the edges of the graph get partitioned and no original edge remains.

I changed the assertion in release/2.4 branch from:

assert(edges);

to

assert(edges || edges_of_points);

I am about to make a 2.4.1 release I would like to have this fixed can you please try using the branch release/2.4?

2 tries:

  1. however you compiled (so the debug messages show)
  2. using this:
cmake  -DCMAKE_BUILD_TYPE=Release ..
denadai2 commented 7 years ago

fixed. Thanks :))