Subject: Showstopper desktop runtime issue

From: Dave Page <[email-masked]>
Date: Thu, 22 Mar 2018 09:49:27 +0000

All,

As you know, the 3.0 release is currently on hold as we discovered late
yesterday that the re-vamped desktop runtime will not run on Gnome 3.26 and
later. This is because the GTK project, and later Gnome, have removed
support for the System Tray on which the new runtime relies.

They have replaced it with a notification mechanism, however this doesn't
really meet our needs as what we want is a place (the tray icon) to attach
a menu to control the pgAdmin server; we don't really use notifications as
such.

I see a number of possible ways around this:

1) Return to the previous runtime. I think this is at best a short-term
solution, as the re-visited Annulen version of the QtWebKit seems to be
getting little attention at the moment, and this would re-introduce many
known bugs caused by WebKit.

2) Re-work the current runtime code to remove the tray icon, and utilise
desktop/start menu items to signal the running instance to show the logs,
configure the server, exit etc. This should work, but will be kinda klunky.

3) Put effort into polishing Joao's Electron based runtime. This might be a
good long term solution as it would remove the need to have any C++ code of
our own, and might allow us to use Electron's update mechanism to do
software updates. The downsides are that we would lose support for dockable
tabs (new windows only), and it wouldn't work on CentOS/RHEL 6 which we
currently support.

Thoughts and comments please folks? How do we want to proceed? I'm
currently leaning towards 2 for v3, and possibly moving to 3 in the long
term.

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

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

---

From: Akshay Joshi <[email-masked]>
Date: Thu, 22 Mar 2018 15:35:07 +0530

On Thu, Mar 22, 2018 at 3:19 PM, Dave Page <[email-masked]> wrote:

> 3) Put effort into polishing Joao's Electron based runtime. This might be
> a good long term solution as it would remove the need to have any C++ code
> of our own, and might allow us to use Electron's update mechanism to do

    Option 2 seems good to me.

-- 
*Akshay Joshi*

*Sr. Software Architect *

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

---

From: Neel Patel <[email-masked]>
Date: Thu, 22 Mar 2018 15:49:27 +0530

Hi,

> currently leaning towards 2 for v3, and possibly moving to 3 in the long

As per our previous efforts on Qt's web rendering framework, I am not in
favor of adding it again as it add lots of dependency and complexity.
I would suggest to go for option 2 - To re-work the current runtime code
and find out how to get already running instance of pgadmin4.

---

From: Dave Page <[email-masked]>
Date: Thu, 22 Mar 2018 10:22:05 +0000

> and find out how to get already running instance of pgadmin4.

We have a shared memory interlock as well as temp/lock files that encode
the executable path into their name that handles that already, though it
doesn't seem to be working quite as expected when you run from a Mac
Appbundle (which Akshay is working on). The issue would be how we signal
the running instance and tell it to do something, e.g. exit.

---

From: Murtuza Zabuawala <[email-masked]>
Date: Thu, 22 Mar 2018 16:18:05 +0530

> known bugs caused by WebKit.
​I would not prefer going back after seeing QtWebkit & QtWebEngine issues
in the past.​

> configure the server, exit etc. This should work, but will be kinda klunky.
​+1​

> tabs (new windows only), and it wouldn't work on CentOS/RHEL 6 which we
​This is a good alternative but there are some downside of Electron,
- It takes longer to start application
- High cpu & ram usage (I have used Slack, Atom & VSCode all of them used
Electron)

---

From: Joao De Almeida Pereira <[email-masked]>
Date: Thu, 22 Mar 2018 14:57:09 +0000

Hello Hackers,
Here is our take on the 3 options present:
1) QtWebkit and QtWebEngine

Pros:
- Webkit is a mature technology that as been around for some time
- Apparently the Fork of Webkit we were using as been catching up
Cons:
- We are using a Fork
- It is to far behind of the today browsers and the competition keep
evolving making it even harder for them to catch up
- Problems with the environment from the past, lagginess, lack of support

2) Rework runtime to find a running PGAdmin and attach to it

Pros:
- We already made the big move from Webkit to this version
- Add smarts to the application to do not run itself if it is already
running, or kill the currently running application

Cons:
- More C++ code thrown around
- Add more dependency on our QT application
- Have specific code for Gnome, not even a OS version but a window manager

3) Electron

Pros:
- Full Javascript runtime, no more C++ code to handle
- Self packaging for all the environments
Cons:
- No fully supported on Linux based OS with old libstdc++, (This might
solve the problem: https://github.com/mattermost/desktop/issues/312)
- CPU/RAM high utilization (Found a issues around and the majority of them
have solutions like CSS animations running or settings on the created
windows)
- Electron does not support tabs by default, only HTML tabs

After combing through these options with some pros and cons  here are my
thoughts:
1) This options was always cluncky from the beginning, the fact that we are
working with a browser that is currently 26k commits behind Webkit:master
is concerning. So I do not believe this is a viable option. As a personal
opinion is we need to release fast, then we should go with what we have now
and not go back to this option.
2) This option is not very appealing to me, because we would be pilling
code into the QT portion of the application, that I hope we remove in the
future, that currently is untested to solve a problem caused by a Window
Manager......
I would be more in favor of creating a Application Indicator that would
support 2 actions, Kill running pgAdmins and launch the browser to access
them. There is a lot of interesting websites that talk about this, and how
to develop. I had to download one to have a docker indicator..... But as I
said in a previous thread, I believe that this should be a 3rd party
application and not a first class citizen on pgAdmin, as the majority of
the ones that I found are.
3) Electron can to play, first when we though about removing QTWebkit,
because it always packs a browser with it and also and there is a very big
Open Source Community being it. It came back again when when we saw that we
were ready to ditch the browser. (As a personal note I dislike applications
that I install in my machine and pop browser open to do anything, this is a
personal issue that I would like to see if it was shared by others that was
why we decided to park Electron for a second time. Because if our users are
ok with it there is no need to add extra complexity to the product)
The most interesting thing about the cons that I found in Electron there is
an issue open for them and a bunch of different solutions to try to handle
it, or even advises on how to handle it. This option also allow us to focus
less on browser compatibility as the main target of our development will
become Chromium which is the base of browsers like UC Browser, Vivaldi,
Opera, Google Chrome.

As you could see from my long long email, I am biased towards options 3,
not because I started the push for it, but because I believe it is the
right step for this product. This being said, I think that releasing now
with this current issue is Ok as a first step to somewhere.

Thanks
Joao

---

From: Dave Page <[email-masked]>
Date: Thu, 22 Mar 2018 16:14:14 +0000

Hi

On Thu, Mar 22, 2018 at 2:57 PM, Joao De Almeida Pereira <
[email-masked]> wrote:

> 1) This options was always cluncky from the beginning, the fact that we
> are working with a browser that is currently 26k commits behind
> Webkit:master is concerning. So I do not believe this is a viable option.
> As a personal opinion is we need to release fast, then we should go with
> what we have now and not go back to this option.
> The most interesting thing about the cons that I found in Electron there
> is an issue open for them and a bunch of different solutions to try to
> handle it, or even advises on how to handle it. This option also allow us
> to focus less on browser compatibility as the main target of our
> development will become Chromium which is the base of browsers like UC
> Browser, Vivaldi, Opera, Google Chrome.
>

I think in the longer term, 3 is probably the best option. Whilst the
current architecture (where it works) is a good improvement and gets rid of
the QtWebKit/QtWebEngine problems, I'm not a huge fan of having a server
and browser; I much prefer the idea of having a single app.

How much effort do you think it would be to get the Electron based browser
to a usable state, in which everything is nicely packaged and buildable,
but without the tab support?

---

From: Magnus Hagander <[email-masked]>
Date: Thu, 22 Mar 2018 17:17:03 +0100

> Here is our take on the 3 options present:

This looks like a good summary, so I'm going to pick this one to comment on
:)

> - Problems with the environment from the past, lagginess, lack of support
Yeah, this one hasn't exactly caused a "little" set of complaints so far.
It might be workable for absolute stop-gap, but not beyond that.

> - Have specific code for Gnome, not even a OS version but a window manager

Annoying as it is, I think this is the least bad option at this point.

3) Electron
> solve the problem: https://github.com/mattermost/desktop/issues/312)

Losing support for things like RHEL6 would make it completely unworkable
for several of my largest customers. Particularly in large enterprise
organisations, this would be a very substantial issue.

> have solutions like CSS animations running or settings on the created

This does sound bad. But do we actually know if this is worse in Electron
than it is in the option #2? I mean sure, we point to things like Slack,
but that may not be because of electron, it may be because the app running
inside it?

> - Electron does not support tabs by default, only HTML tabs

I think that also makes it a showstopper. This was another one of the main
complaints I have personally heard from people going from pgadmin3 ->
pgadmin4, and enough to make people not want to use it at all. It would be
really bad to go back to that.

> what we have now and not go back to this option.

Yeah, that option definitely has no future long-term.

> the ones that I found are.

I can't comment on the specific ways to sort it out, but I think *basing*
things in option 2 is by far the best option. If it's just an additional
add-on that can be made a dependency of the packages it's not a huge
problem (provided this add-on is available on the major platforms like
rhel, ubuntu, debian of course)

> Browser, Vivaldi, Opera, Google Chrome.

Please don't ever give up browser independence for the *web* version of
pgadmin. Don't be That Project (TM).

(And don't give up on proper tabs either, but I'm sure Electron might catch
up in that eventually -- and the issue around RHEL6 will also go away
eventually)

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/>
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

---

From: Dave Page <[email-masked]>
Date: Thu, 22 Mar 2018 16:28:25 +0000

Hi

On Thu, Mar 22, 2018 at 4:17 PM, Magnus Hagander <[email-masked]>
wrote:

> This looks like a good summary, so I'm going to pick this one to comment
> on :)
>

:-)

> It might be workable for absolute stop-gap, but not beyond that.

Right.

> organisations, this would be a very substantial issue.

That's good to know. There are clunky workarounds (shipping different libcs
for example, but that potentially adds licensing issues).

Sidenote: It would only be an issue for desktop mode. Web mode should not
be affected.

>
>
>
>> - CPU/RAM high utilization (Found a issues around and the majority of
>> them have solutions like CSS animations running or settings on the created
>> windows)
>>
>

We don't know for sure, but we do know that Chrome in general is a bit of a
hog. It's certainly not a stretch to think a combination of those things
are why people (correctly) see browser based apps as being more resource
hungry.

> really bad to go back to that.

To clarify; it would mean no tabs, but not single window. That was already
working in the PoC. In other words, helpfiles, the debugger and query tools
could all be opened in new windows, just not tabs on the same window that
could be docked and un-docked.

I suspect for most people that would be enough.

> rhel, ubuntu, debian of course)

It would just be a modified version of what we have. Instead of having an
icon in the system tray, we'd probably have multiple Start Menu icons to
replace the tray icon menu. They would have to signal a running instance to
do something, or become a new instance and then do the something if nothing
is running already.

> pgadmin. Don't be That Project (TM).

Not on my watch!

>
> (And don't give up on proper tabs either, but I'm sure Electron might
> catch up in that eventually -- and the issue around RHEL6 will also go away
> eventually)
>

RHEL 6 is in support until 2024, though it's already halfway through the
maintenance 2 phase. It's definitely going, but we really don't know how
many folks might still be using it in production on systems they're
updating and using pgAdmin on. That last bit is important; many folks will
continue to run production servers on RHEL/CentOS 6 for years, but how many
are using them for client-side stuff or actively updating things like
pgAdmin on them?

---

From: Robert Eckhardt <[email-masked]>
Date: Thu, 22 Mar 2018 12:38:26 -0400

On Thu, Mar 22, 2018 at 12:28 PM, Dave Page <[email-masked]> wrote:

> That's good to know. There are clunky workarounds (shipping different
> libcs for example, but that potentially adds licensing issues).
>
> We don't know for sure, but we do know that Chrome in general is a bit of
> a hog. It's certainly not a stretch to think a combination of those things

I honestly think this is a fair criticism. I like electron and wish it
weren't.

>> I think that also makes it a showstopper. This was another one of the
>> main complaints I have personally heard from people going from pgadmin3 ->

Agreed, I also think that adding tabs is a doable feature it just isn't an
'out of the box' thing.

> are using them for client-side stuff or actively updating things like

RHEL 6 is the #1 OS for GPDB so if we have customers installing server side
or wanting to we'd be on this pretty quickly.

As an aside, I'm interested in who and how people are using the Linux
version. How many are using Linux on the desktop and how many are
installing the server. My assumption is that people using the linux distro
are installing the server but I have no actual information to base that on.

-- Rob

---

From: Dave Page <[email-masked]>
Date: Thu, 22 Mar 2018 16:58:46 +0000

> do something, or become a new instance and then do the something if nothing

Of course, another option here might be to figure out that we're running
under Gnome/GTK at runtime, and if so, create an indicator icon and menu
instead of the tray icon. That is, apparently, what Skype and other similar
apps do now. The indicator icons go on the right of the top menu bar (kinda
like where tray icons go on macOS).

---

From: Joao De Almeida Pereira <[email-masked]>
Date: Thu, 22 Mar 2018 18:27:47 +0000

Hello Hackers

In the PoC we did with Electron last month this was the point where we
stopped

What did we accomplish:
 - Use Electron as a runtime and packaging solution for the application
 - Support opening new windows when the preferences ask for them
 - Make the application generally work
 - Use Chrome as a default browser for the application
 - Building scripts for all platforms using `yarn`, please review Readme
 - The packaged Python version is 3.6 to Mac and Linux, and 3.4 to Windows
 - In our point of view it is a simpler way to generate the installers

Work in progress:
 - No random port for the server, so you can only start 1 instance per
machine
 - Tab support, there is no native support for tabs in Electron. It is
possible to do that, and eventually you will see a option in the menu to
create a new tab, but for this PoC we decided to disable the creation of
tabs. Tabs need to be implemented using HTML and cannot be ripped of from
the current window, like in Chrome
 - Did not test in CentOS, but tested in Ubuntu and it is working (We tried
but the electron required GLIBC 2.25 that was not on the version of CentOS
that we had)
 - In Linux despite the fact that we close the window, the application is
still running and need to be killed by hand
 - We didn't test Debugger opening in new window
 - Loading screen has no reference to pgAdmin
 - No logging file for the runtime
 - Windows we are using python 3.4 and using prior version of psycopg2
2.5.6 and pycrypto 2.6.1 (The version of psycopg2 is not the correct one,
this is because we couldn't find a precompile version of psycopg2)
 - This is just a spike and the code looks pretty messy. This need to be
changed in order to make it more readable and have some tests around it
 - Murtuza and Fahar were not able to run the application in Windows
 - Khushboo was not able to run Ubuntu version

Given this was the status at the time, we need to pick and choose what we
really want to implement right out of the box and what could be postponed.
In order to generate Windows build and ensure that the Linux build is
working we need so help. If we could have access to the machines that you
use to build pgAdmin or access to the venv folder that is generated in
these machines we could try to create a build from that.

The changes we produced still applies cleanly on master and can be found
in: https://github.com/greenplum-db/pgadmin4/tree/electron-over-master

Thanks
Victoria & Joao

On Thu, Mar 22, 2018 at 12:58 PM Dave Page <[email-masked]> wrote:

>>> I can't comment on the specific ways to sort it out, but I think
>>> *basing* things in option 2 is by far the best option. If it's just an
>>> additional add-on that can be made a dependency of the packages it's not a
>>> huge problem (provided this add-on is available on the major platforms like

---

From: Magnus Hagander <[email-masked]>
Date: Fri, 23 Mar 2018 11:08:23 +0100

Right.

> are why people (correctly) see browser based apps as being more resource

It is, but is it more of a hog than other modern browsers? :) (I mean,
every single Electron app I've ever used has been absolutely horrible from
a CPU/RAM/Battery utilization, to the point that I've deleted them all, but
blame needs to be assigned to the right place)

> I suspect for most people that would be enough.

What people want, in my experience, is it for different queries. Haven't
really seen requests for it when it comes to anything other than that. But
people do definitely want the ability to do those both in tabs and in
windows, by their choice, if at all possible.

:)

> are using them for client-side stuff or actively updating things like

I doubt RHEL will very much be used on desktop systems all the way until
2024. But definitely still is in my experience, but it won't be used *that*
long. I still see it, but it's starting to go away, but it's the usual case
of large enterprises shifting platform and needing to certify a gazillion
little desktop apps and hardware gizmos before they can move...

---

From: Magnus Hagander <[email-masked]>
Date: Fri, 23 Mar 2018 11:10:16 +0100

On Thu, Mar 22, 2018 at 5:38 PM, Robert Eckhardt <[email-masked]>
wrote:

> RHEL 6 is the #1 OS for GPDB so if we have customers installing server
> side or wanting to we'd be on this pretty quickly.
>

My experience is actually the opposite in a lot of cases. The server
pgadmin is used primarily by those of my customers who are using Windows --
mainly as a workaround for the fact that the performance experience of the
desktop app on Windows was horrible.

On Mac I don't think I've seen anybody choose the server version if it's a
primary tool for them (some still have a shared pgadmin for people who only
touch it at very infrequent cases, but it's not common). On Linux, I see a
mix.

---

From: Dave Page <[email-masked]>
Date: Fri, 23 Mar 2018 11:27:21 +0000

Hi

On Thu, Mar 22, 2018 at 6:27 PM, Joao De Almeida Pereira <
[email-masked]> wrote:

>  - Did not test in CentOS, but tested in Ubuntu and it is working (We
> tried but the electron required GLIBC 2.25 that was not on the version of
> CentOS that we had)
I just tried building the PoC again, and got much further than before - in
fact I did get a working app bundle out at the end, however the dist build
did spew out the errors below:

piranha:electron dpage$ yarn dist
yarn run v1.3.2
$ ./node_modules/.bin/electron-builder
  • electron-builder version=20.0.7
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=dist/electron-builder.yaml
  • no native production dependencies
  • asar using is disabled — it is strongly not recommended solution=enable
asar and use asarUnpack to unpack files that must be externally available
  • packaging       platform=darwin arch=x64 electron=1.8.2
appOutDir=dist/mac
  • signing         file=dist/mac/pgAdmin 4.app identityName=Developer ID
Application: <redacted> identityHash=<redacted>
Error: Command failed: codesign --verify --deep --strict --verbose=2
/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin 4.app
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper NP.app
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper NP.app
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper EH.app
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper.app
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper.app
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/pgAdmin 4 Helper EH.app
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Mantle.framework/Versions/Current/.
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Mantle.framework/Versions/Current/.
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Squirrel.framework/Versions/Current/.
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Squirrel.framework/Versions/Current/.
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current/.
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/ReactiveCocoa.framework/Versions/Current/.
--prepared:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/.
--validated:/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin
4.app/Contents/Frameworks/Electron Framework.framework/Versions/Current/.
/Users/dpage/git/pgadmin4-electron/electron/dist/mac/pgAdmin 4.app: No such
file or directory

    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

---

From: Dave Page <[email-masked]>
Date: Fri, 23 Mar 2018 12:00:23 +0000

> like where tray icons go on macOS).

I investigated this, and have failed to find anything about how to do this
so far.

However, the following does fix the problem:

1) # dnf install gnome-shell-extension-topicons-plus
2) Run gnome-tweak-tool
3) Enable TopIcons Plus

There are apparently ways to enable the extension globally from the command
line. Need to test that (and figure out if it would be considered bad form
to do so).