Skip to content

Issues with omnidb-server package

Hi,

First of all, thank you very much for your efforts on including OmniDB server and PostgreSQL debugger plugin into Debian PGDG repository.

Since one of our users reported an issue with OmniDB when upgrading from 2.15.0 to the version available in PGDG, I'm pasting here what I found.

I performed some tests using Debian 9 and Debian 10. Customer reported the issue on Ubuntu 18.04, though, but I didn't test on Ubuntu yet.

First of all, after installation of package omnidb-server from PGDG, the omnidb-server tries to start but it can't, because the Python 3 module pexpect is not installed:

root@omnidbuatdebian9:~# systemctl status omnidb-server
● omnidb-server.service - OmniDB server daemon
   Loaded: loaded (/lib/systemd/system/omnidb-server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-06-13 11:57:00 GMT; 5min ago
  Process: 8263 ExecStart=/usr/bin/omnidb-server -c /etc/omnidb.conf (code=exited, status=1/FAILURE)
 Main PID: 8263 (code=exited, status=1/FAILURE)

Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/__init__.py", line 1, in <module>
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:     from . import login, connections, users, workspace, tree, tree_snippets, tree_postgresql, tree_oracle, tree_mysql, tre
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/login.py", line 6, in <module>
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:     from OmniDB import ws_core
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:   File "/usr/lib/python3/dist-packages/OmniDB/ws_core.py", line 40, in <module>
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]:     import pexpect
Jun 13 11:57:00 omnidbuatdebian9 omnidb-server[8263]: ImportError: No module named 'pexpect'
Jun 13 11:57:00 omnidbuatdebian9 systemd[1]: omnidb-server.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 11:57:00 omnidbuatdebian9 systemd[1]: omnidb-server.service: Unit entered failed state.
Jun 13 11:57:00 omnidbuatdebian9 systemd[1]: omnidb-server.service: Failed with result 'exit-code'.

This can be fixed by installing python3-pexpect and then restarting the service:

apt install python3-pexpect
systemctl restart omnidb-server

So please add python3-pexpect as a dependency of omnidb-server.

The second issue is that, even after manually installing python3-pexpect, the service still does not start on Debian 9:

root@omnidbuatdebian9:~# systemctl status omnidb-server
● omnidb-server.service - OmniDB server daemon
   Loaded: loaded (/lib/systemd/system/omnidb-server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-06-13 12:05:06 GMT; 178ms ago
  Process: 8415 ExecStart=/usr/bin/omnidb-server -c /etc/omnidb.conf (code=exited, status=1/FAILURE)
 Main PID: 8415 (code=exited, status=1/FAILURE)

Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/__init__.py", line 1, in <module>
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:     from . import login, connections, users, workspace, tree, tree_snippets, tree_postgresql, tree_oracle, tree_mysql, tre
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/login.py", line 6, in <module>
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:     from OmniDB import ws_core
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:   File "/usr/lib/python3/dist-packages/OmniDB/ws_core.py", line 619, in <module>
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]:     from tornado.platform.asyncio import AnyThreadEventLoopPolicy
Jun 13 12:05:06 omnidbuatdebian9 omnidb-server[8415]: ImportError: cannot import name 'AnyThreadEventLoopPolicy'
Jun 13 12:05:06 omnidbuatdebian9 systemd[1]: omnidb-server.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 12:05:06 omnidbuatdebian9 systemd[1]: omnidb-server.service: Unit entered failed state.
Jun 13 12:05:06 omnidbuatdebian9 systemd[1]: omnidb-server.service: Failed with result 'exit-code'.

This happens because the version of the Python module tornado available in Debian 9 is 4.4.3, which does not have the AnyThreadEventLoopPolicy object yet:

root@omnidbuatdebian9:~# apt-cache policy python3-tornado
python3-tornado:
  Installed: 4.4.3-1
  Candidate: 4.4.3-1
  Version table:
 *** 4.4.3-1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status

OmniDB server needs tornado at least version 5.1.1 installed to work properly. Here I can see that version 5.1.1 is available on Debian 10. Please note that today we released OmniDB 2.16.0, and in the packages we are embedding tornado 6.0.3 which also works fine with OmniDB server.

So I tested with Debian 10 and indeed the version available is 5.1.1:

root@omnidbuatdebian10:~# apt-cache policy python3-tornado
python3-tornado:
  Installed: 5.1.1-4
  Candidate: 5.1.1-4
  Version table:
 *** 5.1.1-4 500
        500 http://deb.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status

Installing the omnidb-server package will still not work at first, because of the missing python3-pexpect:

root@omnidbuatdebian10:~# systemctl status omnidb-server
● omnidb-server.service - OmniDB server daemon
   Loaded: loaded (/lib/systemd/system/omnidb-server.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2019-06-13 13:23:25 GMT; 1min 29s ago
  Process: 5688 ExecStart=/usr/bin/omnidb-server -c /etc/omnidb.conf (code=exited, status=1/FAILURE)
 Main PID: 5688 (code=exited, status=1/FAILURE)

Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:     from . import views
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/__init__.py", line 1, in <module>
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:     from . import login, connections, users, workspace, tree, tree_snippets, tree_postgresql, tree_oracle, tree_mysql, tr
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:   File "/usr/lib/python3/dist-packages/OmniDB_app/views/login.py", line 6, in <module>
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:     from OmniDB import ws_core
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:   File "/usr/lib/python3/dist-packages/OmniDB/ws_core.py", line 40, in <module>
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]:     import pexpect
Jun 13 13:23:25 omnidbuatdebian10 omnidb-server[5688]: ModuleNotFoundError: No module named 'pexpect'
Jun 13 13:23:25 omnidbuatdebian10 systemd[1]: omnidb-server.service: Main process exited, code=exited, status=1/FAILURE
Jun 13 13:23:25 omnidbuatdebian10 systemd[1]: omnidb-server.service: Failed with result 'exit-code'.

But after installing python3-pexpect on Debian 10, this way:

apt install python3-pexpect
systemctl restart omnidb-server

Then the service works fine as you can see:

root@omnidbuatdebian10:~# systemctl status omnidb-server
● omnidb-server.service - OmniDB server daemon
   Loaded: loaded (/lib/systemd/system/omnidb-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2019-06-13 13:26:02 GMT; 2s ago
 Main PID: 5883 (omnidb-server)
    Tasks: 1 (limit: 2347)
   Memory: 50.6M
   CGroup: /system.slice/omnidb-server.service
           └─5883 /usr/bin/python3 /usr/bin/omnidb-server -c /etc/omnidb.conf

Jun 13 13:26:02 omnidbuatdebian10 systemd[1]: Starting OmniDB server daemon...
Jun 13 13:26:02 omnidbuatdebian10 systemd[1]: Started OmniDB server daemon.

I ran some tests against this server and it works properly.

So the 2 issues here are:

    1. omnidb-server requires python3-pexpect and this should be marked as a dependency;
    1. omnidb-server requires python3-tornado >= 5.1.1, which is only available in Debian 10, so omnidb-server only works on Debian 10 atm.

Just as a side note, in either Debian 9 and Debian 10 I installed the PostgreSQL plugin of the OmniDB debugger and it works very well. I just had to do this:

apt install postgresql-11-omnidb
echo "shared_preload_libraries = 'omnidb_plugin'" >> /etc/postgresql/11/main/postgresql.conf
systemctl restart postgresql

And then created the omnidb_plugin extension. Which is very nice and helpful for users of OmniDB debugger. Thanks again.

Best regards,

William Ivanski

The OmniDB Team