UPDATE with json_populate_recordset empty array crashes server

From: Marks Polakovs <marks-mailinglists(at)markspolakovs(dot)me>
To: "pgsql-bugs" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: UPDATE with json_populate_recordset empty array crashes server
Date: 2019-07-31 08:55:14
Message-ID: 16c473d9703.bcae5a61323706.3752002245992279523@markspolakovs.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

The following sequence of commands causes a reproducible backend crash:

$ createdb test

$ psql test

test=# CREATE TABLE test (foo text);

test=# WITH json_cte AS (SELECT * FROM json_populate_recordset(null::test, '[]'))

test-# UPDATE test

test-# SET foo = json_cte.foo

test-# FROM json_cte;

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.

Here's the postgres output:

wrote crash dump to file "crashdumps\postgres-pid14356-221788734.mdmp"

2019-07-31 10:45:17.989 CEST [1744] LOG:  server process (PID 14356) was terminated by exception 0xC0000005

2019-07-31 10:45:17.989 CEST [1744] DETAIL:  Failed process was running: WITH json_cte AS (SELECT * FROM json_populate_recordset(null::test, '[]'))

        UPDATE test

        SET foo = json_cte.foo

        FROM json_cte;

2019-07-31 10:45:17.989 CEST [1744] HINT:  See C include file "ntstatus.h" for a description of the hexadecimal value.

2019-07-31 10:45:17.990 CEST [1744] LOG:  terminating any other active server processes

2019-07-31 10:45:18.016 CEST [18716] WARNING:  terminating connection because of crash of another server process

2019-07-31 10:45:18.016 CEST [18716] 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.

2019-07-31 10:45:18.016 CEST [18716] HINT:  In a moment you should be able to reconnect to the database and repeat your command.

2019-07-31 10:45:18.073 CEST [1744] LOG:  all server processes terminated; reinitializing

2019-07-31 10:45:18.174 CEST [4436] FATAL:  the database system is in recovery mode

2019-07-31 10:45:18.177 CEST [1724] LOG:  database system was interrupted; last known up at 2019-07-31 10:39:13 CEST

2019-07-31 10:45:30.266 CEST [1724] LOG:  database system was not properly shut down; automatic recovery in progress

2019-07-31 10:45:30.303 CEST [1724] LOG:  redo starts at 0/B4F00530

2019-07-31 10:45:30.303 CEST [1724] LOG:  invalid record length at 0/B4F00568: wanted 24, got 0

2019-07-31 10:45:30.307 CEST [1724] LOG:  redo done at 0/B4F00530

2019-07-31 10:45:30.501 CEST [1744] LOG:  database system is ready to accept connections

VERSION(): PostgreSQL 11.1, compiled by Visual C++ build 1914, 64-bit

Running on Windows 10.0.17134.885

Crash dump is attached.

All the best,

Marks

Attachment Content-Type Size
postgres-pid14356-221788734.mdmp application/octet-stream 3.9 MB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergei Kornilov 2019-07-31 09:54:10 Re: UPDATE with json_populate_recordset empty array crashes server
Previous Message Daniel Gustafsson 2019-07-31 07:54:17 Re: BUG #15932: Module passwordcheck doesn't reference previous hooks