Skip to content

Postgresml and plpython3u cannot coexist #1484

Open
@maparent

Description

@maparent

Tried both with my laptop (Apple silicon) homebrew postgresql-15 (with latest postgresml, master tip) and with the ghcr.io/postgresml/postgresml:2.8.2 image (also arm64).

Giving the docker steps:

docker run \
                   -it \
                   -v postgresml_data:/var/lib/postgresql \
                   -p 5433:5432 \
                   -p 8000:8000 \
                   ghcr.io/postgresml/postgresml:2.8.2 \
                   sh

apt update
apt install postgresql-plpython3-15
sudo -u postgresml psql -d postgresml

create extension plpython3u;
CREATE FUNCTION basic() RETURNS text AS 'return "hello"' LANGUAGE plpython3u;

And the Postgres server crashes

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.
The connection to the server was lost. Attempting reset: Failed.
!?>

I did not suspect the interaction at first, so I got deep into plpython; the crash happens in PLy_initialize, at the moment of calling PyImport_ImportModule("plpy"). Setting up memory debug says there is an allocation without holding the GIL. Importing any module crashes in the same way, and we never get to the plpy initialization function.

My suspicion is that the interpreter created by pyo3 and the one created by plpython use the same structures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions