There is a known issue in PostGIS where the function standardize_address() may cause a Greenplum segment process to crash with a segmentation fault (SIGSEGV) when an overly long and unparseable input string is passed as a parameter.
This issue occurs when the function fails to properly parse the input as a valid address and the input length exceeds the internal buffer limit.
The crash may occur under the following conditions:
The input value cannot be successfully parsed into an address by standardize_address()
The input string is sufficiently long
An internal error buffer overflows
The segment hosting the data terminates unexpectedly
gpadmin=# SELECT standardize_address('us_lex','us_gaz','us_rules',repeat('x', 200)); -- Input not long enough, no crash
standardize_address
---------------------
(,,,,,,,,,,,,,,,)
gpadmin=# SELECT standardize_address('us_lex','us_gaz','us_rules',repeat('x', 300));
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
CREATE TABLE test_postgis_table (
street_address TEXT
);
INSERT INTO test_postgis_table
VALUES (repeat('x', 300));
SELECT
standardize_address(
'us_lex',
'us_gaz',
'us_rules',
replace(street_address, '@', ' ')
|| ', Boston, MA, 123456'
)::text
FROM test_postgis_table;
Observed error:
ERROR: Error on receive from seg1 slice1 10.159.240.162:20001 pid=2637080:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The R&D team has confirmed that this behavior is caused by a known defect in the code. This issue is acknowledged and will be addressed in a future Greenplum release.
To prevent segment crashes, ensure that problematic rows with excessively long address values are excluded before invoking standardize_address().
SELECT
length(street_address),
street_address
FROM test_postgis_table where length(street_address) > 100;
Example output:
-[ RECORD 1 ]--+---------------------------------------------------------
length | 300
street_address | xxxxxxxxxxxxxxxxxxxxxxx.......
Remove rows with overly long address values
Apply a length check before calling standardize_address()