Re: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling isbroken on Windows. - Mailing list pgadmin-hackers

From Dave Page
Subject Re: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling isbroken on Windows.
Date
Msg-id CA+OCxozgxKo5sO=2cwRubEh1H1z0C+qtZD-X62kF2SiLs32b5g@mail.gmail.com
Whole thread Raw
In response to [pgAdmin4][Patch]: RM #3277 Runtime startup error handling is brokenon Windows.  (Akshay Joshi <akshay.joshi@enterprisedb.com>)
Responses Re: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling isbroken on Windows.
List pgadmin-hackers
Hi

On Thu, May 10, 2018 at 2:00 PM, Akshay Joshi <akshay.joshi@enterprisedb.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.

 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-packages:/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-packages:/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.

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

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

pgadmin-hackers by date:

Previous
From: Akshay Joshi
Date:
Subject: [pgAdmin4][Patch]: RM #3277 Runtime startup error handling is brokenon Windows.
Next
From: Anthony Emengo
Date:
Subject: Re: [pgadmin4][patch] Initial patch to decouple from ACI Tree