Thread: PostgreSQL 9.2beta4 (& git HEAD) server crash on creating extension plpython3u

PostgreSQL 9.2beta4 (& git HEAD) server crash on creating extension plpython3u

From
Sachin Srivastava
Date:

Hi all,

On my Mac 10.6.8 using ActiveState Python 3.2.2, I am getting a crash when I try to execute "CREATE EXTENSION plpython3u"
This is the backtrace:

Program received signal SIGABRT, Aborted.
0x00007fff899a40b6 in __kill ()
(gdb) bt
#0  0x00007fff899a40b6 in __kill ()
#1  0x00007fff89a449f6 in abort ()
#2  0x000000010a5da84c in Py_InitializeEx ()
#3  0x0000000100bd7467 in _PG_init ()
#4  0x00000001003d8892 in internal_load_library ()
#5  0x00000001003d835e in load_external_function ()
#6  0x00000001000c0509 in fmgr_c_validator ()
#7  0x00000001003dc808 in OidFunctionCall1Coll ()
#8  0x00000001000c01e0 in ProcedureCreate ()
#9  0x00000001001563ca in CreateProceduralLanguage ()
#10 0x00000001002c60c8 in standard_ProcessUtility ()
#11 0x00000001002c49a9 in ProcessUtility ()
#12 0x000000010014005d in execute_sql_string ()
#13 0x00000001001404f8 in execute_extension_script ()
#14 0x0000000100141459 in CreateExtension ()
#15 0x00000001002c51b0 in standard_ProcessUtility ()
#16 0x00000001002c49a9 in ProcessUtility ()
#17 0x00000001002c38f6 in PortalRunUtility ()
#18 0x00000001002c3a9b in PortalRunMulti ()
#19 0x00000001002c3085 in PortalRun ()
#20 0x00000001002bcb16 in exec_simple_query ()
#21 0x00000001002c1416 in PostgresMain ()
#22 0x000000010026d1d9 in BackendRun ()
#23 0x000000010026c898 in BackendStartup ()
#24 0x0000000100269684 in ServerLoop ()
#25 0x0000000100268fa3 in PostmasterMain ()
#26 0x00000001001dcd4d in main ()
(gdb) 

"CREATE EXTENSION plpython2u" works when I compile the same code using ActiveState Python 2.7.

So is it an issue with the ActiveState Python 3.2??



--
Regards,
Sachin Srivastava
EnterpriseDB, India
On 8/21/12 6:34 AM, Sachin Srivastava wrote:
> Hi all,
> 
> On my Mac 10.6.8 using ActiveState Python 3.2.2, I am getting a crash when
> I try to execute "CREATE EXTENSION plpython3u"
> This is the backtrace:

Does it work in Postgres 9.1?


-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



Re: PostgreSQL 9.2beta4 (& git HEAD) server crash on creating extension plpython3u

From
Sachin Srivastava
Date:


On Tue, Aug 21, 2012 at 10:37 PM, Josh Berkus <josh@agliodbs.com> wrote:
On 8/21/12 6:34 AM, Sachin Srivastava wrote:
> Hi all,
>
> On my Mac 10.6.8 using ActiveState Python 3.2.2, I am getting a crash when
> I try to execute "CREATE EXTENSION plpython3u"
> This is the backtrace:

Does it work in Postgres 9.1?
No. I get the same backtrace when I try against the 9.1.5 (REL9_1_STABLE) branch. 


--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



--
Regards,
Sachin Srivastava
EnterpriseDB, India
> No. I get the same backtrace when I try against the 9.1.5 (REL9_1_STABLE)
> branch.

OK, not a regression then.

Can you install plpython3u using non-Activestate python?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



On 21/08/12 20:13, Josh Berkus wrote:
>
>> No. I get the same backtrace when I try against the 9.1.5 (REL9_1_STABLE)
>> branch.

I have reproduced this on Linux, seems like the fix is to to run the 
postmaster with this env variable exported:

PYTHONHOME=/opt/ActivePython-3.2/

(or wherever you installed ActivePython).

To give credit, I found the decisive clue here: 
http://manojadinesh.blogspot.com/2012/06/fatal-python-error-pyinitialize-unable.html

Cheers,
Jan



Re: PostgreSQL 9.2beta4 (& git HEAD) server crash on creating extension plpython3u

From
Sachin Srivastava
Date:
Yes, It worked for me also..
So will this be a workaround? Or do we intend to use something like Py_SetPythonHome() before calling Py_Initialize()/

On Wed, Aug 22, 2012 at 3:32 PM, Jan Urbański <wulczer@wulczer.org> wrote:
On 21/08/12 20:13, Josh Berkus wrote:

No. I get the same backtrace when I try against the 9.1.5 (REL9_1_STABLE)
branch.

I have reproduced this on Linux, seems like the fix is to to run the postmaster with this env variable exported:

PYTHONHOME=/opt/ActivePython-3.2/

(or wherever you installed ActivePython).

To give credit, I found the decisive clue here: http://manojadinesh.blogspot.com/2012/06/fatal-python-error-pyinitialize-unable.html

Cheers,
Jan



--
Regards,
Sachin Srivastava
EnterpriseDB, India
On 22/08/12 13:28, Sachin Srivastava wrote:
> Yes, It worked for me also..
> So will this be a workaround? Or do we intend to use something like
> Py_SetPythonHome() before calling Py_Initialize()/

I think the best we can do is to document that for some installations 
you might need to set PYTHONHOME. I don't think we can figure it out at 
runtime (we could then use setenv to fix it). This is similar to having 
to set PYTHONPATH if you want to import code installed in virtualenvs or 
other nonstandard locations.

I'm leaning towards just documenting, mucking around with environment 
variables from inside of Postgres' shared libraries seems like a recipe 
for disaster.

Cheers,
Jan