[pgrouting-users] core dump in server while calling driving_distance function for generating a polygon

While calling the driving_dstance function from routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

ret = alpha_shape(vertices, total_tuples, res, res_count, &err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

--

Dave,

This sounds like you might have multiple librouting.so look here:
/usr/lib/postgresql/8.4/lib/librouting.so
change the version to match yours.

Also try:

locate librouting.so

ldd /usr/lib/postgresql/8.4/lib/librouting.so

and make sure you do not have multiple copies of dependent libraries loaded. Like in /usr/lib and /usr/local/lib

See if you can determine if msg_rsv is getting a null pointer passed to it. But anything is possible if the loading is messed up.

-Steve

On 2/9/2012 12:57 AM, Dave Potts wrote:

While calling the driving_dstance function from routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

  ret = alpha_shape(vertices, total_tuples, res, res_count,&err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

Now problems with the LD_LIBRARY_PATH, but just in case of errors i
removed the extra copies of libroute.so, nochanges.

As I said the problem seems to be alpha_shape routine.

Dave.
Stephen Woodbridge wrote:

Dave,

This sounds like you might have multiple librouting.so look here:
/usr/lib/postgresql/8.4/lib/librouting.so
change the version to match yours.

Also try:

locate librouting.so

ldd /usr/lib/postgresql/8.4/lib/librouting.so

and make sure you do not have multiple copies of dependent libraries
loaded. Like in /usr/lib and /usr/local/lib

See if you can determine if msg_rsv is getting a null pointer passed to
it. But anything is possible if the loading is messed up.

-Steve

On 2/9/2012 12:57 AM, Dave Potts wrote:

While calling the driving_dstance function from routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being
used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

  ret = alpha_shape(vertices, total_tuples, res, res_count,&err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

are you able to call driving_distance directly, without the wrapper?

On Thu, Feb 9, 2012 at 11:26 AM, Dave Potts <dave.potts@pinan.co.uk> wrote:

Now problems with the LD_LIBRARY_PATH, but just in case of errors i
removed the extra copies of libroute.so, nochanges.

As I said the problem seems to be alpha_shape routine.

Dave.
Stephen Woodbridge wrote:

Dave,

This sounds like you might have multiple librouting.so look here:
/usr/lib/postgresql/8.4/lib/librouting.so
change the version to match yours.

Also try:

locate librouting.so

ldd /usr/lib/postgresql/8.4/lib/librouting.so

and make sure you do not have multiple copies of dependent libraries
loaded. Like in /usr/lib and /usr/local/lib

See if you can determine if msg_rsv is getting a null pointer passed to
it. But anything is possible if the loading is messed up.

-Steve

On 2/9/2012 12:57 AM, Dave Potts wrote:

While calling the driving_dstance function from routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being
used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

ret = alpha_shape(vertices, total_tuples, res, res_count,&err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

Hello list

Thanks to those that tried to help me

Problem found

I am calling the function driving_distance from the file
routing_dd_wrappers.sql at line 78.

This is my input data
0 X 3000.000000 Y 3000.000000
1 X 3000.000000 Y 3000.000000
2 X 3000.000000 Y 3000.000000
3 X 3000.000000 Y 3000.000000
4 X 4000.000000 Y 2000.000000
5 X 4000.000000 Y 2000.000000

If you look at it careful, you will notice less than 3 different values
which is the source of the problem. The Alpha_shape_2 routine blow up
with a core dump unless you have 3 or more different alpha values in it.

This little problem is not described in the CGAL support.

Attempts are made to catch it in the route source, but these fail because
it overlooks the problem of the same data appearing twice.

ie do
0 X 3000.000000 Y 3000.000000
1 X 3000.000000 Y 3000.000000
2 X 3000.000000 Y 3000.000000
3 X 3000.000000 Y 3000.000000

Will pass the current checks.

I think we need to add the following code at line 166 of alpha_drivedist.cpp

Alpha_shape_2 A(points.begin(), points.end(),
                  coord_type(10000),
                  Alpha_shape_2::GENERAL);

  // check that there are more than 3 values in A otherwise you get a core
  // dump
  if( A.number_of_alphas() < 3){

        *err_msg=(char*)"Driving distance requires at least 3 different
distinct values";
        return -1;
  }
  std::vector<Segment> segments;
  std::vector<Segment> result;

ie get the alpha_shape_2 code to check the number of distinct values, if
its less than 3 issue a message but do not core dump and take the database
down.

Dave.

Dave Potts wrote:

Now problems with the LD_LIBRARY_PATH, but just in case of errors i
removed the extra copies of libroute.so, nochanges.

As I said the problem seems to be alpha_shape routine.

Dave.
Stephen Woodbridge wrote:

Dave,

This sounds like you might have multiple librouting.so look here:
/usr/lib/postgresql/8.4/lib/librouting.so
change the version to match yours.

Also try:

locate librouting.so

ldd /usr/lib/postgresql/8.4/lib/librouting.so

and make sure you do not have multiple copies of dependent libraries
loaded. Like in /usr/lib and /usr/local/lib

See if you can determine if msg_rsv is getting a null pointer passed to
it. But anything is possible if the loading is messed up.

-Steve

On 2/9/2012 12:57 AM, Dave Potts wrote:

While calling the driving_dstance function from
routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being
used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

  ret = alpha_shape(vertices, total_tuples, res, res_count,&err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

Hi Dave,

Thank you for digging into this issue and finding a fix. The fix sounds reasonable. Can you open a ticket on this and attach a patch or a git pull request if you have the changes in github.

Thank you for your effort on this.

-Steve

On 2/12/2012 7:17 AM, Dave Potts wrote:

Hello list

Thanks to those that tried to help me

Problem found

I am calling the function driving_distance from the file
routing_dd_wrappers.sql at line 78.

This is my input data
0 X 3000.000000 Y 3000.000000
1 X 3000.000000 Y 3000.000000
2 X 3000.000000 Y 3000.000000
3 X 3000.000000 Y 3000.000000
4 X 4000.000000 Y 2000.000000
5 X 4000.000000 Y 2000.000000

If you look at it careful, you will notice less than 3 different values
which is the source of the problem. The Alpha_shape_2 routine blow up
with a core dump unless you have 3 or more different alpha values in it.

This little problem is not described in the CGAL support.

Attempts are made to catch it in the route source, but these fail because
it overlooks the problem of the same data appearing twice.

ie do
0 X 3000.000000 Y 3000.000000
1 X 3000.000000 Y 3000.000000
2 X 3000.000000 Y 3000.000000
3 X 3000.000000 Y 3000.000000

Will pass the current checks.

I think we need to add the following code at line 166 of alpha_drivedist.cpp

Alpha_shape_2 A(points.begin(), points.end(),
                   coord_type(10000),
                   Alpha_shape_2::GENERAL);

   // check that there are more than 3 values in A otherwise you get a core
   // dump
   if( A.number_of_alphas()< 3){

         *err_msg=(char*)"Driving distance requires at least 3 different
distinct values";
         return -1;
   }
   std::vector<Segment> segments;
   std::vector<Segment> result;

ie get the alpha_shape_2 code to check the number of distinct values, if
its less than 3 issue a message but do not core dump and take the database
down.

Dave.

Dave Potts wrote:

Now problems with the LD_LIBRARY_PATH, but just in case of errors i
removed the extra copies of libroute.so, nochanges.

As I said the problem seems to be alpha_shape routine.

Dave.
Stephen Woodbridge wrote:

Dave,

This sounds like you might have multiple librouting.so look here:
/usr/lib/postgresql/8.4/lib/librouting.so
change the version to match yours.

Also try:

locate librouting.so

ldd /usr/lib/postgresql/8.4/lib/librouting.so

and make sure you do not have multiple copies of dependent libraries
loaded. Like in /usr/lib and /usr/local/lib

See if you can determine if msg_rsv is getting a null pointer passed to
it. But anything is possible if the loading is messed up.

-Steve

On 2/9/2012 12:57 AM, Dave Potts wrote:

While calling the driving_dstance function from
routing_dd_wrappers.sql,
line 78

My postgres server back DIES

I tried rebuilding from source and attaching and instance of gdb to the
server process as pg_backend_pid();

By doing something like gdb /usr/lib/postgresql/9.1/bin/postgres pid
Gdb claims that server process dies in msg_rsv

I think I am using the wrong image because none of the DD code is being
used.

By turning on debug statments, I managed to strace the problem to the
c/c++ interface between alpha_shape

I get lots of prints until the routine

   ret = alpha_shape(vertices, total_tuples, res, res_count,&err_msg);

is called.

I tried puting in calls like

write(2,"Hello\n",6); and elog(ERROR, "Hello world" ,"eeee"); as the
first line in alpha_shape, nothing evers gets printed

So I suspect it might be a linking issue!

Is this a known problem?

What process image should I be attaching gbc to?

regards

Dave

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

--

_______________________________________________
Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users