pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
UPDATE with json_populate_recordset empty array crashes server
3+ messages / 3 participants
[nested] [flat]

* UPDATE with json_populate_recordset empty array crashes server
@ 2019-07-31 08:55 Marks Polakovs <marks-mailinglists@markspolakovs.me>
  2019-07-31 09:54 ` Re: UPDATE with json_populate_recordset empty array crashes server Sergei Kornilov <sk@zsrv.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Marks Polakovs @ 2019-07-31 08:55 UTC (permalink / raw)
  To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>

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

Attachments:

  postgres-pid14356-221788734.mdmp (application/octet-stream, 3.9M) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: UPDATE with json_populate_recordset empty array crashes server
  2019-07-31 08:55 UPDATE with json_populate_recordset empty array crashes server Marks Polakovs <marks-mailinglists@markspolakovs.me>
@ 2019-07-31 09:54 ` Sergei Kornilov <sk@zsrv.org>
  2019-07-31 23:46   ` Re: UPDATE with json_populate_recordset empty array crashes server Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 3+ messages in thread

From: Sergei Kornilov @ 2019-07-31 09:54 UTC (permalink / raw)
  To: Marks Polakovs <marks-mailinglists@markspolakovs.me>; pgsql-bugs <pgsql-bugs@lists.postgresql.org>

Hello

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

Please check in actual release.

I think this was already fixed for a long time: https://www.postgresql.org/docs/11/release-11-2.html
> Fix crash when zero rows are fed to json[b]_populate_recordset() or json[b]_to_recordset() (Tom Lane)

regards, Sergei





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: UPDATE with json_populate_recordset empty array crashes server
  2019-07-31 08:55 UPDATE with json_populate_recordset empty array crashes server Marks Polakovs <marks-mailinglists@markspolakovs.me>
  2019-07-31 09:54 ` Re: UPDATE with json_populate_recordset empty array crashes server Sergei Kornilov <sk@zsrv.org>
@ 2019-07-31 23:46   ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Paquier @ 2019-07-31 23:46 UTC (permalink / raw)
  To: Sergei Kornilov <sk@zsrv.org>; +Cc: Marks Polakovs <marks-mailinglists@markspolakovs.me>; pgsql-bugs <pgsql-bugs@lists.postgresql.org>

On Wed, Jul 31, 2019 at 12:54:10PM +0300, Sergei Kornilov wrote:
> I think this was already fixed for a long time:
> https://www.postgresql.org/docs/11/release-11-2.html
> Fix crash when zero rows are fed to json[b]_populate_recordset()
> or json[b]_to_recordset() (Tom Lane) 

Yes, this has been fixed and it matches to this commit:
commit: eba2ce17121f198316d050e71d8bd049a43783ba
author: Tom Lane <tgl@sss.pgh.pa.us>
date: Thu, 22 Nov 2018 15:14:01 -0500
Fix another crash in json{b}_populate_recordset and json{b}_to_recordset.

And here is the related thread:
https://www.postgresql.org/message-id/15514-59d5b4c4065b178b@postgresql.org
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-07-31 23:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 08:55 UPDATE with json_populate_recordset empty array crashes server Marks Polakovs <marks-mailinglists@markspolakovs.me>
2019-07-31 09:54 ` Sergei Kornilov <sk@zsrv.org>
2019-07-31 23:46   ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox