Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostGIS causing PostgreSQL Segfault #48854

Closed
3 tasks done
thomersch opened this issue Jan 10, 2020 · 3 comments
Closed
3 tasks done

PostGIS causing PostgreSQL Segfault #48854

thomersch opened this issue Jan 10, 2020 · 3 comments
Labels
outdated PR was locked due to age

Comments

@thomersch
Copy link
Contributor

So, I am not entirely sure whether this is a packaging, a linking or a software problem, but maybe someone can have a look and try to understand where this issue is coming from.

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

brew config/brew doctor: https://gist.github.com/thomersch/0a877beed03d39ea28d3f9c011f93f46

What you were trying to do (and why)

You'll need CREATE EXTENSION postgis; CREATE EXTENSION postgis_sfcgal;.

When executing

SELECT ST_StraightSkeleton(
    ST_GeomFromEWKT('SRID=3857;POLYGON((2 1,1 0,0 1,0.999999999999993 2,2 1))')
);

in psql, the PostgreSQL connection process segfaults and the DB has to restart itself. Please note that

SELECT ST_StraightSkeleton(
    ST_GeomFromEWKT('SRID=3857;POLYGON((2 1,1 0,0 1,0.999999999999992 2,2 1))')
);

works absolutely fine. This is not a synthetic issue as it often occurs when using ST_Buffer(), e.g.

SELECT ST_StraightSkeleton(
    ST_Buffer(ST_GeomFromEWKT('SRID=3857;LINESTRING (1 1, 5 5)'), 1)
);

I am running current versions of everything related: PostgreSQL 12.1, Postgis 3.0.0, Geos 3.8.0, SFCGAL 1.3.7, Proj 6.3.0

I was able to reproduce this on a different mac, but not on either Linux or FreeBSD that's why I assume this might have to do something with the packaging/building.

The stacktrace of the crash: https://gist.github.com/thomersch/69f2410242e9962680020da405c691e2

Step-by-step reproduction instructions (by running brew install commands)

brew install postgis
brew services start postgres
createdb foo
psql foo
CREATE EXTENSION postgis; CREATE EXTENSION postgis_sfcgal;
SELECT ST_StraightSkeleton(
    ST_Buffer(ST_GeomFromEWKT('SRID=3857;LINESTRING (1 1, 5 5)'), 1)
);
@fxcoudert
Copy link
Member

For the record, the stack trace ends up at:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x000000014f11c7a8 libgmp.10.dylib`mpq_cmp_numden + 113
    frame #1: 0x000000010b184fe3 libSFCGAL.1.dylib`CGAL::CartesianKernelFunctors::Compare_xy_2<CGAL::Simple_cartesian<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > >::operator()(CGAL::Point_2<CGAL::Simple_cartesian<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > > const&, CGAL::Point_2<CGAL::Simple_cartesian<boost::multiprecision::number<boost::multiprecision::backends::gmp_rational, (boost::multiprecision::expression_template_option)1> > > const&) const + 27

Does the issue persist if you run brew reinstall -s gmp and brew reinstall -s sfcgal?

@thomersch
Copy link
Contributor Author

So I reinstalled gmp and sfcgal from source, restarted postgres, but the same behaviour persists.

@thomersch
Copy link
Contributor Author

Doesn't look like it's a macOS or homebrew related problem: Oslandia/SFCGAL#202

@lock lock bot added the outdated PR was locked due to age label Feb 22, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants