<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hi Steve,<br><br>thanks for your swift reply!<br><br>well, rebuilding the table helps in that the source and target values are not too high anymore then.<br><br>i have a bunch of info here for you, i'll split it:<br><br>the query is:<br><br>SELECT * FROM shortest_path('SELECT id, source::integer,<br>target::integer, cost::double precision FROM ma_routing', 64629654, 64630762, false,<br>false)<br><br>sample data to get crashing:<br><br> source | target | cost | reverse_cost | sens | x1 | y1 | x2 | y2 | rule | to_cost | length | ogc_fid | id | length_shortest | length_reverse_shortest<br>----------+----------+------------------+------------------+-------------+------------+-----------+------------+-----------+------+---------+------------------+---------+----+-----------------+-------------------------<br> 64629390 | 64629391 | 2.98541825999812 | 2.98541825999812 | double sens | -73.167897 | 42.705496 | -73.167836 | 42.705791 | | | 33.1713139999791 | 582 | 1 | | <br> 64629654 | 64630762 | 15.4108990193286 | 15.4108990193286 | double sens | -73.115287 | 42.646935 | -73.113203 | 42.647023 | | | 171.232211325874 | 718 | 2 | | <br> 64629691 | 64629692 | 1.03336877316695 | 1.03336877316695 | double sens | -73.047407 | 42.648043 | -73.047296 | 42.648106 | | | 11.4818752574105 | 738 | 3 | | <br>(3 rows)<br><br><br>if you change source and target in any existing table and make it at least as high as the values here, crashing is guaranteed!<br><br><br><br>ok, here comes the whole thing, this was my original post with a lot of bla bla:<br><br><br>While running a shortest_path query i had the following error message:<br><br>SELECT * FROM shortest_path('SELECT id, source::integer,<br>target::integer, cost::double precision FROM ma_routing', 64629654, 64630762, false,<br>false)<br><br>" server closed the connection unexpectedly".<br><br>I do not have negative cost or reverse_cost values. In another thread a long time ago it was advised to rebuild the "source" and "target" tables using "assign_vertex_id".<br><br>The posting is at:<br>http://postgis.refractions.net/pipermail/postgis-users/2008-June/020137.html<br><br>That function i cannot find.<br><br>For the following samples goes:<br>Projection _should_ be in 4326.<br><br><br>Here's a sample of the data in the routing table:<br><br>select * from ma_routing limit 3;<br><br> source | target | cost | reverse_cost | sens | x1 | y1 | x2 | y2 | rule | to_cost | length | ogc_fid | id | length_shortest | length_reverse_shortest<br>----------+----------+------------------+------------------+-------------+------------+-----------+------------+-----------+------+---------+------------------+---------+----+-----------------+-------------------------<br> 64629390 | 64629391 | 2.98541825999812 | 2.98541825999812 | double sens | -73.167897 | 42.705496 | -73.167836 | 42.705791 | | | 33.1713139999791 | 582 | 1 | | <br> 64629654 | 64630762 | 15.4108990193286 | 15.4108990193286 | double sens | -73.115287 | 42.646935 | -73.113203 | 42.647023 | | | 171.232211325874 | 718 | 2 | | <br> 64629691 | 64629692 | 1.03336877316695 | 1.03336877316695 | double sens | -73.047407 | 42.648043 | -73.047296 | 42.648106 | | | 11.4818752574105 | 738 | 3 | | <br>(3 rows)<br><br>OK, let's take line 2: source=64629654 , target=64630762.<br>Let's do a lookup where the source is the target of line 2, to go from source to target:<br><br>select * from ma_routing where source=64630762;<br><br> source | target | cost | reverse_cost | sens | x1 | y1 | x2 | y2 | rule | to_cost | length | ogc_fid | id | length_shortest | length_reverse_shortest<br>----------+----------+------------------+------------------+-------------+------------+-----------+------------+-----------+------+---------+------------------+---------+-------+-----------------+-------------------------<br> 64630762 | 64629653 | 10.5842324315852 | 10.5842324315852 | double sens | -73.115501 | 42.647023 | -73.115287 | 42.648065 | | | 117.602582573169 | 1502 | 5692 | | <br> 64630762 | 64630760 | 10.324871753826 | 10.324871753826 | double sens | -73.115287 | 42.646049 | -73.114822 | 42.647023 | | | 114.720797264734 | 7776 | 11879 | | <br>(2 rows)<br><br><br>Maybe i am overlooking something.<br>The geometry column is in another table.<br><br>Roads table is called "027_nosr_r".<br><br>Sorry if this is going to be confusing but i want to get the same rows from the "roads" table (which is the origin) as from the routing table.<br><br><br>Here's a sample of the roads table:<br><br>select * from "027_nosr_r" limit 3;<br><br> ogc_fid | wkb_geometry | fnode_ | tnode_ | lpoly_ | rpoly_ | length | reg25_ | rd_1 | rd_2 | rd_3 | rd_4 | rd_5 | rd_6 | rd_7 | rd_8 | rd_9 | rd_10 | rd_11 | rd_12 | rd_13 | rd_14 | rd_15 | rd_16 | rd_17 | rd_18 | rd_19 | rd_20 | rd_21 | rd_22 | rd_23 | rd_24 | rd_25 | rd_26 | rd_27 | rd_28 | textsearchable_index_col<br>---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+-----------+-----------+----------+---------+---------+------+------+------+------+------+------+------+------+------------------------------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------------------------------+-------+-------+------------+-------+-------+--------------------------<br> 582 | 0102000020E6100000030000002D060FD3BE4A52C0BABA63B14D5A4540B0FECF61BE4A52C0ADA415DF505A4540DAC534D3BD4A52C0D367075C575A4540 | 64629390 | 64629391 | 206361314 | 206361314 | 0.000000 | 3915987 | 3915987 | 0 | 0 | 0 | 6 | 100 | 6 | 0 | 1 | | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | fc#4 | 25003 | 0 | 2500346225 | | |<br> 718 | 0102000020E610000004000000C8B3CBB73E4752C0A2D11DC4CE5245408124ECDB494752C0DDCF29C8CF52454032225168594752C00072C284D1524540DAA9B9DC604752C0416150A6D1524540 | 64629654 | 64630762 | 206354958 | 206354960 | 0.000000 | 3916275 | 3916275 | 0 | 0 | 0 | 6 | 100 | 6 | 0 | | Brown St | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | fc#4@hn#RE12-98#LO13-99 | 25003 | 0 | 2500300555 | 01220 | 01220 | 'st':2 'brown':1<br> 738 | 0102000020E6100000020000007FA65EB7084352C06CB3B112F3524540D34ECDE5064352C0B22B2D23F5524540 | 64629691 | 64629692 | 206354450 | 206354451 | 0.000000 | 3916317 | 3916317 | 0 | 0 | 0 | 6 | 100 | 6 | 0 | | | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | fc#4 | 25003 | 0 | 2500360225 | | |<br>(3 rows)<br><br><br><br>Let's take 64629654 as fnode_, which is the "source column" of the road, like in line 2 of the first sql, source=64629654 , target=64630762.<br><br>select * from "027_nosr_r" where fnode_=64629654 ;<br><br><br> ogc_fid | wkb_geometry | fnode_ | tnode_ | lpoly_ | rpoly_ | length | reg25_ | rd_1 | rd_2 | rd_3 | rd_4 | rd_5 | rd_6 | rd_7 | rd_8 | rd_9 | rd_10 | rd_11 | rd_12 | rd_13 | rd_14 | rd_15 | rd_16 | rd_17 | rd_18 | rd_19 | rd_20 | rd_21 | rd_22 | rd_23 | rd_24 | rd_25 | rd_26 | rd_27 | rd_28 | textsearchable_index_col<br>---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+-----------+-----------+----------+---------+---------+------+------+------+------+------+------+------+------+------------------------------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------------------------------+-------+-------+------------+-------+-------+--------------------------<br> 718 | 0102000020E610000004000000C8B3CBB73E4752C0A2D11DC4CE5245408124ECDB494752C0DDCF29C8CF52454032225168594752C00072C284D1524540DAA9B9DC604752C0416150A6D1524540 | 64629654 | 64630762 | 206354958 | 206354960 | 0.000000 | 3916275 | 3916275 | 0 | 0 | 0 | 6 | 100 | 6 | 0 | | Brown St | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | fc#4@hn#RE12-98#LO13-99 | 25003 | 0 | 2500300555 | 01220 | 01220 | 'st':2 'brown':1<br>(1 row)<br><br><br>OK, let's consider line 2 of the routing table: source=64629654 , target=64630762. Same second sample above, only this time from the "roads" table, not the routing table.<br>Let's do a lookup where the source is the target of line 2, to go from source to target:<br><br>tnode_="target":<br><br>select * from "027_nosr_r" where fnode_=64629654 limit 3;<br><br><br> ogc_fid | wkb_geometry | fnode_ | tnode_ | lpoly_ | rpoly_ | length | reg25_ | rd_1 | rd_2 | rd_3 | rd_4 | rd_5 | rd_6 | rd_7 | rd_8 | rd_9 | rd_10 | rd_11 | rd_12 | rd_13 | rd_14 | rd_15 | rd_16 | rd_17 | rd_18 | rd_19 | rd_20 | rd_21 | rd_22 | rd_23 | rd_24 | rd_25 | rd_26 | rd_27 | rd_28 | textsearchable_index_col<br>---------+------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+----------+-----------+-----------+----------+---------+---------+------+------+------+------+------+------+------+------+------------------------------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------------------------------+-------+-------+------------+-------+-------+--------------------------<br> 718 | 0102000020E610000004000000C8B3CBB73E4752C0A2D11DC4CE5245408124ECDB494752C0DDCF29C8CF52454032225168594752C00072C284D1524540DAA9B9DC604752C0416150A6D1524540 | 64629654 | 64630762 | 206354958 | 206354960 | 0.000000 | 3916275 | 3916275 | 0 | 0 | 0 | 6 | 100 | 6 | 0 | | Brown St | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | fc#4@hn#RE12-98#LO13-99 | 25003 | 0 | 2500300555 | 01220 | 01220 | 'st':2 'brown':1<br>(1 row)<br><br><br><br><br>thanks,<br><br>EJ<br><br><br><br><div>> Date: Sun, 13 Nov 2011 11:11:29 -0500<br>> From: woodbri@swoodbridge.com<br>> To: pgrouting-users@lists.osgeo.org<br>> Subject: Re: [pgrouting-users] bug in pgRouting: server closed the connection unexpectedlyþ<br>> <br>> On 11/13/2011 3:36 AM, E. . wrote:<br>> > hi all,<br>> ><br>> > i finally figured out what the problem is.<br>> ><br>> > high values of "source" and "target" fields crash pgRouting.<br>> ><br>> > with high i mean this:<br>> ><br>> > source | target |<br>> > ----------+---------<br>> > 64629390 | 64629391 |<br>> > 64629654 | 64630762 |<br>> ><br>> > must be a register overflow.<br>> ><br>> > that's prpbably why the solution was to rebuild the tables, if the<br>> > source and targets fields will be renumbered.<br>> <br>> Hi EJ,<br>> <br>> Thank you for the report. Which method were you using? Dijkstra, astar, <br>> shooting star? Can you give use the query the was causing the fault? It <br>> might also be helpful if you could provide the results of:<br>> <br>> select min(source), min(target), max(source), max(target), count(*)<br>> from <your table>;<br>> <br>> Does renumbering the table solve your problem?<br>> What was the error/crash message you were getting?<br>> <br>> In my mind, it is a bug to crash the server or the connection, we should <br>> understand and fail gracefully if we have to but not crash.<br>> <br>> Thank you for help,<br>> <br>> -Steve<br>> _______________________________________________<br>> Pgrouting-users mailing list<br>> Pgrouting-users@lists.osgeo.org<br>> http://lists.osgeo.org/mailman/listinfo/pgrouting-users<br></div>                                            </div></body>
</html>