PANIC Segmentation Fault Master process received signal SIGSEGV during query planning with PostGIS - Greenplum
search cancel

PANIC Segmentation Fault Master process received signal SIGSEGV during query planning with PostGIS - Greenplum

book

Article ID: 452108

calendar_today

Updated On:

Products

VMware Tanzu Greenplum VMware Tanzu Greenplum / Gemfire VMware Tanzu Data Suite VMware Tanzu Data Suite

Issue/Introduction

The database crashes and encounters a PANIC (Segmentation Fault) during query execution or planning when the Postgres planner is evaluating PostGIS spatial predicates.

The following error is observed in the database logs:

PANIC: Unexpected internal error: Master process received signal SIGSEGV

The issue specifically triggers when the Postgres Optimizer is turned off (SET optimizer = off;) and a spatial query is explained or executed:

NOTICE: estimate_selectivity called with null input
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.

Environment

GPDB 7.8.2

Cause

This is caused by a known defect in PostGIS. When the Postgres planner asks PostGIS to estimate the selectivity of a spatial predicate (such as &&), it requires looking up the column's statistics.

If the statistics exist but do not contain a spatial histogram, PostGIS returns a default fallback estimate and incorrectly attempts to free a null pointer. Freeing the null pointer causes a panic and terminates the master process.

Resolution

Permenant Fix: This defect is targeted to be fixed in release 7.8.4.

Workaround

Use the GPORCA optimizer, which is unaffected by this defect. GPORCA does not call the operator's selectivity function (gserialized_gist_sel()), but rather reads pg_statistic directly and derives its own cardinality.

To apply the workaround, ensure the optimizer is enabled for the affected queries:

  1. Connect to the database.

  2. Run the following command before executing spatial queries: SET optimizer = on;

Additional Information

For more details regarding the upstream PostGIS defect, refer to the following resources: