BUG #13823: Database crash - import requests in plpython3u

Поиск
Список
Период
Сортировка
От george.wesington@gmail.com
Тема BUG #13823: Database crash - import requests in plpython3u
Дата
Msg-id 20151217133409.3886.97313@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #13823: Database crash - import requests in plpython3u  (Terje Elde <terje@elde.net>)
Список pgsql-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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Marcin Sieńko
Дата:
Сообщение: Re: BUG #13817: Query planner strange choose while select/count small part of big table - complete
Следующее
От: Marcin Sieńko
Дата:
Сообщение: Re: BUG #13817: Query planner strange choose while select/count small part of big table - complete