BUG #16071: Server crashes when 'numeric' data type is used on any plpython Function

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: isaac(dot)open(at)gmail(dot)com
Subject: BUG #16071: Server crashes when 'numeric' data type is used on any plpython Function
Date: 2019-10-21 06:33:25
Message-ID: 16071-051c0170b04b1a6d@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16071
Logged by: Isaac Aguirre
Email address: isaac(dot)open(at)gmail(dot)com
PostgreSQL version: 12.0
Operating system: Windows 7
Description:

# Steps to Reproduce
Install extension plpython3u
Create function using data type numeric as an input, may be unique input or
in combination with other data types.
Use Function in query such as SELECT or UPDATE.

#Example
CREATE OR REPLACE FUNCTION network.test(number numeric)
RETURNS numeric
LANGUAGE 'plpython3u'
VOLATILE
PARALLEL UNSAFE
COST 100
AS $BODY$return number
$BODY$;

SELECT network.test(5);

#Log Output
2019-10-20 13:21:59.116 PDT [2864] LOG: server process (PID 12560) was
terminated by exception 0xC0000005
2019-10-20 13:21:59.116 PDT [2864] DETAIL: Failed process was running:
SELECT network.test(5)
2019-10-20 13:21:59.116 PDT [2864] HINT: See C include file "ntstatus.h"
for a description of the hexadecimal value.
2019-10-20 13:21:59.117 PDT [2864] LOG: terminating any other active server
processes
2019-10-20 13:21:59.119 PDT [13156] WARNING: terminating connection because
of crash of another server process
2019-10-20 13:21:59.119 PDT [13156] 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-10-20 13:21:59.119 PDT [13156] HINT: In a moment you should be able to
reconnect to the database and repeat your command.
2019-10-20 13:21:59.121 PDT [7960] WARNING: terminating connection because
of crash of another server process
2019-10-20 13:21:59.121 PDT [7960] 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-10-20 13:21:59.121 PDT [7960] HINT: In a moment you should be able to
reconnect to the database and repeat your command.
2019-10-20 13:21:59.122 PDT [3040] WARNING: terminating connection because
of crash of another server process
2019-10-20 13:21:59.122 PDT [3040] 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-10-20 13:21:59.122 PDT [3040] HINT: In a moment you should be able to
reconnect to the database and repeat your command.
2019-10-20 13:21:59.131 PDT [2824] WARNING: terminating connection because
of crash of another server process
2019-10-20 13:21:59.131 PDT [2824] 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-10-20 13:21:59.131 PDT [2824] HINT: In a moment you should be able to
reconnect to the database and repeat your command.
2019-10-20 13:21:59.174 PDT [2864] LOG: all server processes terminated;
reinitializing
2019-10-20 13:21:59.233 PDT [10152] LOG: database system was interrupted;
last known up at 2019-10-20 08:04:14 PDT
2019-10-20 13:22:00.523 PDT [7104] FATAL: the database system is in
recovery mode
2019-10-20 13:22:00.894 PDT [13076] FATAL: the database system is in
recovery mode
2019-10-20 13:22:02.009 PDT [8300] FATAL: the database system is in
recovery mode
2019-10-20 13:22:02.973 PDT [12948] FATAL: the database system is in
recovery mode
2019-10-20 13:22:03.612 PDT [12708] FATAL: the database system is in
recovery mode
2019-10-20 13:22:04.924 PDT [9844] FATAL: the database system is in
recovery mode
2019-10-20 13:22:05.564 PDT [3520] FATAL: the database system is in
recovery mode
2019-10-20 13:22:05.962 PDT [8052] FATAL: the database system is in
recovery mode
2019-10-20 13:22:06.898 PDT [1264] FATAL: the database system is in
recovery mode
2019-10-20 13:22:06.960 PDT [9512] FATAL: the database system is in
recovery mode
2019-10-20 13:22:07.534 PDT [9316] FATAL: the database system is in
recovery mode
2019-10-20 13:22:07.981 PDT [13044] FATAL: the database system is in
recovery mode
2019-10-20 13:22:08.051 PDT [9520] FATAL: the database system is in
recovery mode
2019-10-20 13:22:08.898 PDT [10744] FATAL: the database system is in
recovery mode
2019-10-20 13:22:08.957 PDT [12804] FATAL: the database system is in
recovery mode
2019-10-20 13:22:09.526 PDT [9992] FATAL: the database system is in
recovery mode
2019-10-20 13:22:09.973 PDT [9212] FATAL: the database system is in
recovery mode
2019-10-20 13:22:10.029 PDT [10504] FATAL: the database system is in
recovery mode
2019-10-20 13:22:10.904 PDT [9292] FATAL: the database system is in
recovery mode
2019-10-20 13:22:10.978 PDT [9796] FATAL: the database system is in
recovery mode
2019-10-20 13:22:11.534 PDT [10784] FATAL: the database system is in
recovery mode
2019-10-20 13:22:11.959 PDT [8096] FATAL: the database system is in
recovery mode
2019-10-20 13:22:12.023 PDT [12532] FATAL: the database system is in
recovery mode
2019-10-20 13:22:12.900 PDT [12724] FATAL: the database system is in
recovery mode
2019-10-20 13:22:13.066 PDT [8256] FATAL: the database system is in
recovery mode
2019-10-20 13:22:13.998 PDT [4152] FATAL: the database system is in
recovery mode
2019-10-20 13:22:14.008 PDT [3392] FATAL: the database system is in
recovery mode
2019-10-20 13:22:14.902 PDT [9960] FATAL: the database system is in
recovery mode
2019-10-20 13:22:15.538 PDT [12580] FATAL: the database system is in
recovery mode
2019-10-20 13:22:16.958 PDT [10152] LOG: database system was not properly
shut down; automatic recovery in progress
2019-10-20 13:22:17.000 PDT [10152] LOG: redo starts at 0/85D5338
2019-10-20 13:22:17.000 PDT [10152] LOG: invalid record length at
0/85D5418: wanted 24, got 0
2019-10-20 13:22:17.000 PDT [10152] LOG: redo done at 0/85D53E0
2019-10-20 13:22:17.264 PDT [2864] LOG: database system is ready to accept
connections

#Additional Info
Issue could be reproduced as well in PostgreSQL 11 before update.
If inputs in functions are switched to text, text[], int, int[] they work
without any problem.
Using python37.dll from Stack Builder installer, issue was present with
previous versions as well.
https://www.postgresql.org/docs/12/plpython-data.html describes
compatibility with a data type mapping to Decimal.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Ford 2019-10-21 08:54:54 Re: Re: BUG #16068: Collate of 'Norwegian Bokmål' is problematic
Previous Message Tom Lane 2019-10-21 05:03:54 Re: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql