PL/Python fails on new NetBSD/PPC 8.0 install - Mailing list pgsql-hackers

From Tom Lane
Subject PL/Python fails on new NetBSD/PPC 8.0 install
Date
Msg-id 25662.1560896200@sss.pgh.pa.us
Whole thread Raw
Responses Re: PL/Python fails on new NetBSD/PPC 8.0 install
List pgsql-hackers
I noticed that the old NetBSD 5.1.5 installation I had on my G4 Mac
was no longer passing our regression tests, because it has a strtof()
that is sloppy about underflow.  Rather than fight with that I decided
to update it to something shinier (well, as shiny as you can get on
hardware that's old enough to apply for a driver's license).  I stuck in
NetBSD/macppc 8.0, and things seem to work, except that PL/Python
crashes on launch.  I see something like this in the postmaster log:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1162, in _install_external_importers
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
  File "<frozen importlib._bootstrap>", line 149, in __enter__
  File "<frozen importlib._bootstrap>", line 84, in acquire
RuntimeError: no current thread ident
Fatal Python error: initexternalimport: external importer setup failed

Current thread 0xffffffff (most recent call first):
2019-06-18 17:40:59.629 EDT [20764] LOG:  server process (PID 23714) was terminated by signal 6: Abort trap
2019-06-18 17:40:59.629 EDT [20764] DETAIL:  Failed process was running: CREATE FUNCTION stupid() RETURNS text AS
'return"zarkon"' LANGUAGE plpython3u; 

and a stack trace like

#0  0xfddd383c in _lwp_kill () from /usr/lib/libc.so.12
#1  0xfddd3800 in raise () from /usr/lib/libc.so.12
#2  0xfddd2e38 in abort () from /usr/lib/libc.so.12
#3  0xf4c371dc in fatal_error () from /usr/pkg/lib/libpython3.7.so.1.0
#4  0xf4c38370 in _Py_FatalInitError () from /usr/pkg/lib/libpython3.7.so.1.0
#5  0xf4c38f7c in Py_InitializeEx () from /usr/pkg/lib/libpython3.7.so.1.0
#6  0xf4c38fc0 in Py_Initialize () from /usr/pkg/lib/libpython3.7.so.1.0
#7  0xfdc8d548 in PLy_initialize () at plpy_main.c:135
#8  0xfdc8da0c in plpython3_validator (fcinfo=<optimized out>)
    at plpy_main.c:192
#9  0x01d4a904 in FunctionCall1Coll (flinfo=0xffffd608,
    collation=<optimized out>, arg1=<optimized out>) at fmgr.c:1140
#10 0x01d4b03c in OidFunctionCall1Coll (functionId=functionId@entry=16464,
    collation=collation@entry=0, arg1=arg1@entry=32774) at fmgr.c:1418
#11 0x0196a9d0 in ProcedureCreate (
    procedureName=procedureName@entry=0xfdb0aac0 "transaction_test1",
    procNamespace=procNamespace@entry=2200, replace=replace@entry=false,
    returnsSet=returnsSet@entry=false, returnType=returnType@entry=2278,
    proowner=10, languageObjectId=languageObjectId@entry=16465,
    languageValidator=languageValidator@entry=16464,
    prosrc=prosrc@entry=0xfdb0abf8 "\nfor i in range(0, 10):\n    plpy.execute(\"INSERT INTO test1 (a) VALUES (%d)\" %
i)\n   if i % 2 == 0:\n        plpy.commit()\n    else:\n        plpy.rollback()\n", probin=probin@entry=0x0,  
...

The "no current thread ident" error rings some vague bells, but I could
not find any previous discussion matching that in our archives.

This is with today's HEAD of our code and the python37-3.7.1 package from
NetBSD 8.0.

Any ideas?  I'm not so wedded to PL/Python that I'll spend a lot of time
making it go on this old box ... but seeing that 3.7 is still pretty
bleeding-edge Python, I wonder if other people will start getting this
too.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: O(N^2) when building multi-column MCV lists
Next
From: Melanie Plageman
Date:
Subject: Re: Avoiding hash join batch explosions with extreme skew and weird stats