Re: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling is broken on Windows.

From: Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling is broken on Windows.
Date: 2018-05-11 06:23:54
Message-ID: CANxoLDeRkUiwp9_rnsyC7=G9mSq=adHHKr_T4M475f0VaupJag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

On Thu, May 10, 2018 at 7:38 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Thu, May 10, 2018 at 2:00 PM, Akshay Joshi <
> akshay(dot)joshi(at)enterprisedb(dot)com> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch to fix RM #3277 Runtime startup error
>> handling is broken on Windows.
>>
>> This issue is regression of RM #3177 "Sporadically crashes on Windows
>> when exit". Where below code of pgAdmin4.cpp creates the problem:
>> *QObject::connect(server, SIGNAL(finished()), server,
>> SLOT(deleteLater()));*
>>
>> In case when PythonPath is not provided then application server not
>> started and server thread finished there execution, due to the above line
>> of code *Destructor* of Server class has been called and we are
>> accessing the function *server->getError().length() *at line no 251 of
>> pgAdmin4.cpp, which cause the application crash.
>>
>> I have removed that line and tested RM #3177 and RM# 3277, both are
>> working fine.
>>
>> Please review and test it.
>>
>
> So my first test was compiled against Python 3, but my config was still
> pointing at a Python 2 venv. I got the error below in the console of
> QtCreator.
>
> Also, wouldn't it make more sense to move the connect that you removed so
> it only happens once the server is up and running? That way we will still
> ensure it gets properly deleted when appropriate, but not prematurely if an
> error occurs during startup.
>

Agreed, I have move that call to other place when server is up and
running. Attached is the modified patch.

>
> Starting /Users/dpage/git/pgadmin4/build-pgAdmin4-Desktop_Qt_5_10_1_
> clang_64bit-Debug/pgAdmin4.app/Contents/MacOS/pgAdmin4...
> Python path: "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packa
> ges:/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7"
> Python Home: ""
> Fatal Python error: Py_Initialize: unable to load the file system codec
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/encodings/__init__.py",
> line 123
> raise CodecRegistryError,\
> ^
> SyntaxError: invalid syntax
>
> Current thread 0x00007fffcbb433c0 (most recent call first):
> The program has unexpectedly finished.
> /Users/dpage/git/pgadmin4/build-pgAdmin4-Desktop_Qt_5_10_1_
> clang_64bit-Debug/pgAdmin4.app/Contents/MacOS/pgAdmin4 crashed.
>
> Starting /Users/dpage/git/pgadmin4/build-pgAdmin4-Desktop_Qt_5_10_1_
> clang_64bit-Debug/pgAdmin4.app/Contents/MacOS/pgAdmin4...
> Python path: "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packa
> ges:/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7"
> Python Home: ""
> Fatal Python error: Py_Initialize: unable to load the file system codec
> File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/encodings/__init__.py",
> line 123
> raise CodecRegistryError,\
> ^
> SyntaxError: invalid syntax
>
> Current thread 0x00007fffcbb433c0 (most recent call first):
> The program has unexpectedly finished.
> /Users/dpage/git/pgadmin4/build-pgAdmin4-Desktop_Qt_5_10_1_
> clang_64bit-Debug/pgAdmin4.app/Contents/MacOS/pgAdmin4 crashed.
>

Yes, it is reproducible. I have tried putting try catch around "
*Py_Initialize*", but no success.

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

--
*Akshay Joshi*

*Sr. Software Architect *

*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*

Attachment Content-Type Size
RM_3277_v2.patch application/octet-stream 727 bytes

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Aditya Toshniwal 2018-05-11 06:28:50 Re: JS Test error on Windows
Previous Message Anthony Emengo 2018-05-10 14:38:31 Re: [pgadmin4][patch] Initial patch to decouple from ACI Tree