Re: [pgAdmin4] [PATCH] Simplify Server's python setup

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Jan Alexander Steffens <jan(dot)steffens(at)gmail(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4] [PATCH] Simplify Server's python setup
Date: 2017-01-27 11:04:35
Message-ID: CA+OCxowsuSnfnWNhEYMFemheSKxwH5G=4zr=-qfSN1YL=QQWGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Thu, Jan 26, 2017 at 7:22 PM, Jan Alexander Steffens
<jan(dot)steffens(at)gmail(dot)com> wrote:
> On Thu, Jan 26, 2017 at 3:58 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>> In the meantime, I'm thinking something like the attached patch would
>> be more appropriate. The only issue I can find with it at the moment
>> (having just tested on a Mac dev environment for now) is that if
>> initialisation fails and you enter a new Python Executable path, the
>> Py_Finalize()/Py_Initialize cycle isn't enough to make the change - it
>> seems to be because Py_SetProgramName() doesn't have any effect when
>> called again. In other words, you can give it the correct interpreter
>> and hit OK to attempt to run the server again, but it still won't work
>> until you actually restart the app.
>>
>> Any ideas?
>
>
> Looking through the cpython code, Py_SetPath(NULL) clears the calculated
> module search path again. Try calling this before the Py_Initialize.

Unfortunately that just crashes:

Process: pgAdmin4 [72302]
Path: /Users/USER/*/pgAdmin4.app/Contents/MacOS/pgAdmin4
Identifier: org.pgadmin.pgAdmin4
Version: 1.1.0 (1.1.0)
Code Type: X86-64 (Native)
Parent Process: Qt Creator [71857]
Responsible: pgAdmin4 [72302]
User ID: 501

Date/Time: 2017-01-27 11:04:08.929 +0000
OS Version: Mac OS X 10.12.1 (16B2555)
Report Version: 12
Anonymous UUID: 8EDD1C6E-ECA1-3406-3699-E93A83594C48

Sleep/Wake UUID: 2F80B265-AF26-4822-8D8F-556844AAD638

Time Awake Since Boot: 280000 seconds
Time Since Wake: 7900 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]

VM Regions Near 0:
-->
__TEXT 000000010da00000-000000010da2c000 [ 176K]
r-x/rwx SM=COW /Users/USER/*/pgAdmin4.app/Contents/MacOS/pgAdmin4

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x00007fffc21d5f3c
_platform_strchr$VARIANT$Haswell + 28
1 org.python.python 0x000000010daec349 PySys_SetPath + 24
2 org.pgadmin.pgAdmin4 0x000000010da105a6
Server::Server(unsigned short) + 1046
3 org.pgadmin.pgAdmin4 0x000000010da04ddb main + 795
4 org.pgadmin.pgAdmin4 0x000000010da04a34 start + 52

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Khushboo Vashi 2017-01-27 11:53:26 Re: [pgAdmin4][Patch]: RM 2069 - Wrong tablespace displayed in table properties
Previous Message Surinder Kumar 2017-01-27 10:32:21 Re: [pgAdmin4][Patch]: Fix RM1790 - [Web] Support setting a field's value to "null"