From: george.wesington@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13823: Database crash - import requests in plpython3u
Date: Thu, 17 Dec 2015 13:34:09 +0000
Message-ID: <20151217133409.3886.97313@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 13823
Logged by: George Wesington
Email address: george.wesington@gmail.com
PostgreSQL version: 9.4.5
Operating system: Windows 7 64bit
Description:
Dear PostgreSQL,
i was trying to use requests module in python function but as soon as the
import statement is written in the function the database completely
crashes.
I am using PostgreSQL 9.4.5 on Windows 7 64 bit with 64 bit Python 3.5.1.
The function I am trying to run is following (never mind the empty fields)
:
CREATE OR REPLACE FUNCTION globalapp.f_my_function()
RETURNS TEXT
AS
$$
import requests
api_url = ""
access_token = ""
payload = ""
api_url = api_base_url + "?access_token=" + access_token
api_request = requests.post(api_url, data=payload)
api_response = api_request.text
return api_response
$$
LANGUAGE plpython3u;
The log file after running the function is:
2015-12-17 14:17:05 CET LOG: database system was interrupted; last known up
at 2015-12-17 14:16:05 CET
2015-12-17 14:17:06 CET LOG: database system was not properly shut down;
automatic recovery in progress
2015-12-17 14:17:06 CET LOG: record with zero length at 0/2078150
2015-12-17 14:17:06 CET LOG: redo is not required
2015-12-17 14:17:06 CET LOG: MultiXact member wraparound protections are
now enabled
2015-12-17 14:17:06 CET LOG: database system is ready to accept
connections
2015-12-17 14:17:06 CET LOG: autovacuum launcher started
Fatal Python error: PyThreadState_Get: no current thread
2015-12-17 14:17:17 CET LOG: server process (PID 5184) was terminated by
exception 0xC0000005
2015-12-17 14:17:17 CET DETAIL: Failed process was running: SELECT * FROM
f_my_function()
2015-12-17 14:17:17 CET HINT: See C include file "ntstatus.h" for a
description of the hexadecimal value.
2015-12-17 14:17:17 CET LOG: terminating any other active server processes
2015-12-17 14:17:17 CET WARNING: terminating connection because of crash of
another server process
2015-12-17 14:17:17 CET 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.
2015-12-17 14:17:17 CET HINT: In a moment you should be able to reconnect
to the database and repeat your command.
2015-12-17 14:17:17 CET LOG: all server processes terminated;
reinitializing
After the crash the database needs to be restarted because it cannot be
accessed anymore. The same script runs perfectly when run directly from
python.
Let me know if you need any more information.
Best,
George
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: george.wesington@gmail.com
Subject: Re: BUG #13823: Database crash - import requests in plpython3u
In-Reply-To: <20151217133409.3886.97313@wrigleys.postgresql.org>
References: <20151217133409.3886.97313@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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