PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15420
PG Version10.5
OSUbuntu 16.04.3 LTS
Opened2018-10-04 08:57:34+00
Reported bySergey Mirvoda
StatusOpen

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15420
Logged by:          Sergey Mirvoda
Email address:      (redacted)
PostgreSQL version: 10.5
Operating system:   Ubuntu 16.04.3 LTS
Description:        

Tested on
9.6.2 (Windows server 2012 r2), 10.5 (Ubuntu 16.04.3 LTS), 12devel
(Ubuntu)
9.4.1  (Windows server 2012 r2) works fine.

Steps to reproduce
1. Place this file into PG_DATA directory
https://www.dropbox.com/s/upteflaye9r3fz7/EGRUL_FULL_2018-01-01_X.XML?dl=1

2. Run this query in psql 
select d::xml from
convert_from(pg_read_binary_file('EGRUL_FULL_2018-01-01_X.XML'),'windows-1251')
g(d);

3. Notice connection crashed without restoring
4. Error log 
Sergey Mirvoda, [04.10.18 12:24]
2018-10-04 07:23:39.946 UTC [17114] LOG:  server process (PID 26155) was
terminated by signal 11: Segmentation fault
2018-10-04 07:23:39.946 UTC [17114] DETAIL:  Failed process was running:
select d::xml from
convert_from(pg_read_binary_file('egrul/EGRUL_FULL_2018-01-01_X.XML'),'windows-1251')
g(d);
2018-10-04 07:23:39.946 UTC [17114] LOG:  terminating any other active
server processes
2018-10-04 07:23:39.946 UTC [26143] WARNING:  terminating connection because
of crash of another server process
2018-10-04 07:23:39.946 UTC [26143] DETAIL:  The postmaster has commanded
this server process to roll back the current transaction and exit, because
another server process exited abnormally and possibly corrupted shared
memory.
2018-10-04 07:23:39.946 UTC [26143] HINT:  In a moment you should be able to
reconnect to the database and repeat your command.
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul WARNING:  terminating
connection because of crash of another server process
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul DETAIL:  The postmaster
has commanded this server process to roll back the current transaction and
exit, because another server process exited abnormally and possibly
corrupted shared memory.
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul HINT:  In a moment you
should be able to reconnect to the database and repeat your command.
2018-10-04 07:23:39.949 UTC [26157] postgres@postgres FATAL:  the database
system is in recovery mode
2018-10-04 07:23:39.969 UTC [17114] LOG:  all server processes terminated;
reinitializing
2018-10-04 07:23:40.011 UTC [26158] LOG:  database system was interrupted;
last known up at 2018-10-04 07:23:20 UTC
2018-10-04 07:23:40.942 UTC [26158] LOG:  database system was not properly
shut down; automatic recovery in progress
2018-10-04 07:23:40.947 UTC [26158] LOG:  redo starts at 18/32CAACA0
2018-10-04 07:23:40.947 UTC [26158] LOG:  invalid record length at
18/32CAACD8: wanted 24, got 0
2018-10-04 07:23:40.947 UTC [26158] LOG:  redo done at 18/32CAACA0
2018-10-04 07:23:40.976 UTC [17114] LOG:  database system is ready to accept
connections


We did a very quick research and believe the error is somewhere in
xmlParseBalancedChunkMemory handling code.

Messages

DateAuthorSubject
2018-10-04 08:57:34+00=?utf-8?q?PG_Bug_reporting_form?=BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 09:11:03+00Michael PaquierRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 09:30:45+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 09:38:20+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 10:18:05+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:11:48+00Michael PaquierRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:20:08+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:35:33+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:36:39+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:38:01+00Andrey BorodinRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:38:38+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:41:07+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:43:29+00Andrey BorodinRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 11:47:04+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 14:02:56+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 14:11:47+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 14:31:00+00Alvaro HerreraRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 14:42:31+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 15:02:05+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-04 23:27:06+00Michael PaquierRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 03:40:57+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 04:40:44+00Andrey BorodinRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 05:08:38+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 12:03:17+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 12:08:48+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 12:28:22+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 12:36:18+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 12:44:58+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:22:37+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:26:59+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:38:52+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:46:04+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:53:30+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 13:58:59+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 14:00:18+00Tom LaneRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 14:33:44+00Sergey MirvodaRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 14:48:55+00Pavel StehuleRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 14:57:19+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file
2018-10-05 15:19:08+00Andrew GierthRe: BUG #15420: Server crash. Segmentation fault when parsing xml file