BUG #16132: PostgreSQL 12.1 and PLV8 2.3.13 => PostgreSQL crashes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG #16132: PostgreSQL 12.1 and PLV8 2.3.13 => PostgreSQL crashes

PG Bug reporting form
The following bug has been logged on the website:

Bug reference:      16132
Logged by:          James Inform
Email address:      [hidden email]
PostgreSQL version: 12.1
Operating system:   Mac & Ubuntu 18.04 LTS
Description:        

HI!

I am not sure if my issue is related to PostgreSQL or to the PLV8 extension.

So I just post in case.

I encountered the following severe issue. I am running PostgreSQL 12.1 on
Ubuntu. Postgresql is build from source by myself, but the same issue
appears when I am using Pg12.1 with Postgresapp on Mac.
(www.postgresapp.com)

I am using PLV8 Version 2.3.13.

Steps to reproduce:

1. Create a new database:
create database mytest;

2. Create PLV8 extension
create extension plv8;

3. Create a simple PLV8 function
CREATE OR REPLACE FUNCTION plv8_require()
 RETURNS void
 LANGUAGE plv8
AS
$function$
        var test = 0;
$function$
;

4. Log out and then in again with a new session to the new database
mytest;

5. Run the following set command
SET plv8.start_proc = plv8_require;

6. Run this simple plv8 script
do
$$
plv8.elog(NOTICE,'test');
$$ language plv8
;

7. Now the server goes down with the following log information:

Received signal 4 <unknown> 000107b765be

==== C stack trace ===============================

 [0x00010838ed74]
 [0x7fff5a988f5a]
 [0x000107ab4888]
 [0x000107b7383c]
 [0x000104b07fdc]
 [0x000104b09091]
 [0x000104699360]
 [0x0001049491ac]
 [0x00010733dfdf]
 [0x000104948d1d]
 [0x00010494871d]
 [0x000104947a51]
 [0x000104947121]
 [0x000104944810]
 [0x000104941df7]
 [0x00010488f3ff]
 [0x00010488e80d]
 [0x00010488d76a]
 [0x00010488b37f]
 [0x00010479b5d9]
 [0x7fff5a67a015]
[end of stack trace]
2019-11-22 17:29:05 CET [50424]: [13-1] user=,db=,app=,client= LOG:  server
process (PID 15664) was terminated by signal 4: Illegal instruction: 4
2019-11-22 17:29:05 CET [50424]: [14-1] user=,db=,app=,client= DETAIL:
Failed process was running: do
        $$
        plv8.elog(NOTICE,'test');
        $$ language plv8
       
2019-11-22 17:29:05 CET [50424]: [15-1] user=,db=,app=,client= LOG:
terminating any other active server processes
2019-11-22 17:29:05 CET [11274]: [1-1] user=,db=,app=,client= WARNING:
terminating connection because of crash of another server process
2019-11-22 17:29:05 CET [11274]: [2-1] user=,db=,app=,client= 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-11-22 17:29:05 CET [11274]: [3-1] user=,db=,app=,client= HINT:  In a
moment you should be able to reconnect to the database and repeat your
command.
2019-11-22 17:29:05 CET [50424]: [16-1] user=,db=,app=,client= LOG:  all
server processes terminated; reinitializing
2019-11-22 17:29:05 CET [15806]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55983
2019-11-22 17:29:05 CET [15805]: [1-1] user=,db=,app=,client= LOG:  database
system was interrupted; last known up at 2019-11-22 16:32:06 CET
2019-11-22 17:29:05 CET [15806]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:05 CET [15807]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55984
2019-11-22 17:29:05 CET [15807]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:05 CET [15808]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55985
2019-11-22 17:29:05 CET [15808]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:05 CET [15809]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55986
2019-11-22 17:29:05 CET [15809]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:05 CET [15810]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55987
2019-11-22 17:29:05 CET [15810]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:05 CET [15811]: [1-1]
user=[unknown],db=[unknown],app=[unknown],client=127.0.0.1 LOG:  connection
received: host=127.0.0.1 port=55988
2019-11-22 17:29:05 CET [15811]: [2-1]
user=postgres,db=inst,app=[unknown],client=127.0.0.1 FATAL:  the database
system is in recovery mode
2019-11-22 17:29:06 CET [15805]: [2-1] user=,db=,app=,client= LOG:  database
system was not properly shut down; automatic recovery in progress
2019-11-22 17:29:07 CET [15805]: [3-1] user=,db=,app=,client= LOG:  redo
starts at 4E/765C06D0
2019-11-22 17:29:07 CET [15805]: [4-1] user=,db=,app=,client= LOG:  invalid
record length at 4E/765C07B8: wanted 24, got 0
2019-11-22 17:29:07 CET [15805]: [5-1] user=,db=,app=,client= LOG:  redo
done at 4E/765C0780
2019-11-22 17:29:07 CET [15805]: [6-1] user=,db=,app=,client= LOG:
checkpoint starting: end-of-recovery immediate
2019-11-22 17:29:07 CET [15805]: [7-1] user=,db=,app=,client= LOG:
checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed,
0 recycled; write=0.029 s, sync=0.000 s, total=0.033 s; sync files=0,
longest=0.000 s, average=0.000 s; distance=0 kB, estimate=0 kB
2019-11-22 17:29:07 CET [50424]: [17-1] user=,db=,app=,client= LOG:
database system is ready to accept connections
2019-11-22 17:29:17 CET [15817]: [1-1] user=,db=,app=,client= LOG:
autoprewarm successfully prewarmed 524196 of 524196 previously-loaded blocks

Reply | Threaded
Open this post in threaded view
|

Re: BUG #16132: PostgreSQL 12.1 and PLV8 2.3.13 => PostgreSQL crashes

Michael Paquier-2
On Fri, Nov 22, 2019 at 06:50:14PM +0000, PG Bug reporting form wrote:

> I am not sure if my issue is related to PostgreSQL or to the PLV8 extension.
>
> So I just post in case.
>
> I encountered the following severe issue. I am running PostgreSQL 12.1 on
> Ubuntu. Postgresql is build from source by myself, but the same issue
> appears when I am using Pg12.1 with Postgresapp on Mac.
> (www.postgresapp.com)
>
> I am using PLV8 Version 2.3.13.
Hard to say if this is something directly involving a change in
Postgres or something that plv8 does wrong with any new assumptions
taken in Postgres 12 code.  FWIW, I have seen in the past as well
issues with PLv8 after upgrades to newer versions, and the fix
happened to be only needed in the PL.  How does the trace look like?

For the note, I have noticed that you raised the same issue in the
upstream project:
https://github.com/plv8/plv8/issues/373
--
Michael

signature.asc (849 bytes) Download Attachment