[Debian-med-packaging] Bug#906771: orthanc-postgres: Uncaught exception prevents db intialization (likely related to pg_trgm)

Jacek Kawa jacek.kawa at gmail.com
Mon Aug 20 23:03:59 BST 2018


Package: orthanc-postgresql
Version: 2.2-1
Severity: normal
File: orthanc-postgres
Tags: upstream

Recent version of the plugin fails to import database schema after uncaught exception (likely related to 
pg_trgm extension).

Steps to reproduce:
1. create empty db as specified with /usr/share/doc/orthanc-postgresql/README.Debian (btw, step (3) is twice on the list:)

as the result, fresh user 'orthanc' is the owner of the database 'orthanc_db'

2. restart the Orhtanc to receive:

W0820 23:32:28.907349 main.cpp:1296] Orthanc version: 1.4.1
W0820 23:32:28.908768 OrthancInitialization.cpp:168] Scanning folder "/etc/orthanc/" for configuration files
W0820 23:32:28.908809 OrthancInitialization.cpp:120] Reading the configuration from: "/etc/orthanc/orthanc.json"
W0820 23:32:28.909047 OrthancInitialization.cpp:120] Reading the configuration from: "/etc/orthanc/postgresql.json"
W0820 23:32:28.909100 OrthancInitialization.cpp:120] Reading the configuration from: "/etc/orthanc/worklists.json"
W0820 23:32:28.909131 OrthancInitialization.cpp:120] Reading the configuration from: "/etc/orthanc/serve-folders.json"
W0820 23:32:28.909294 Toolbox.cpp:1367] Falling back to system-wide default locale
W0820 23:32:28.925459 FromDcmtkBridge.cpp:144] Loading the external DICOM dictionary "/usr/share/libdcmtk12/dicom.dic"
W0820 23:32:28.934722 FromDcmtkBridge.cpp:144] Loading the external DICOM dictionary "/usr/share/libdcmtk12/private.dic"
W0820 23:32:28.948061 main.cpp:655] Loading plugin(s) from: /usr/share/orthanc/plugins/
W0820 23:32:28.948297 PluginsManager.cpp:269] Registering plugin 'worklists' (version 1.4.1)
W0820 23:32:28.948310 PluginsManager.cpp:168] Sample worklist plugin is initializing
W0820 23:32:28.948427 PluginsManager.cpp:168] Worklist server is disabled by the configuration file
W0820 23:32:28.948588 PluginsManager.cpp:269] Registering plugin 'serve-folders' (version 1.4.1)
W0820 23:32:28.948770 PluginsManager.cpp:168] ServeFolders: Empty configuration file: No additional folder will be served!
W0820 23:32:28.949510 PluginsManager.cpp:269] Registering plugin 'postgresql-index' (version 2.2)
W0820 23:32:28.950038 PluginsManager.cpp:269] Registering plugin 'postgresql-storage' (version 2.2)
W0820 23:32:28.955020 main.cpp:1088] Using a custom database from plugins
W0820 23:32:28.955051 main.cpp:1099] Using a custom storage area from plugins
W0820 23:32:28.996831 PluginsManager.cpp:168] Trying to enable trigram matching on the PostgreSQL database to speed up wildcard searches. This may take several minutes
E0820 23:32:28.998932 PluginsManager.cpp:164] PostgreSQL error: ERROR:  permission denied to create extension "pg_trgm"
HINT:  Must be superuser to create this extension.
W0820 23:32:28.998999 PluginsManager.cpp:168] Performance warning: Your PostgreSQL server does not support trigram matching
W0820 23:32:28.999009 PluginsManager.cpp:168] -> Consider installing the "pg_trgm" extension on the PostgreSQL server, e.g. on Debian: sudo apt install postgresql-contrib
E0820 23:32:28.999210 PluginsManager.cpp:164] PostgreSQL error: ERROR:  relation "globalproperties" does not exist
LINE 1: SELECT value FROM GlobalProperties WHERE property=$1
                          ^

W0820 23:32:28.999284 PluginsManager.cpp:219] Unregistering plugin 'postgresql-index' (version 2.2)
W0820 23:32:28.999298 PluginsManager.cpp:168] PostgreSQL index is finalizing
W0820 23:32:28.999413 PluginsManager.cpp:219] Unregistering plugin 'postgresql-storage' (version 2.2)
W0820 23:32:28.999427 PluginsManager.cpp:168] PostgreSQL storage area is finalizing
W0820 23:32:28.999535 PluginsManager.cpp:219] Unregistering plugin 'serve-folders' (version 1.4.1)
W0820 23:32:28.999582 PluginsManager.cpp:219] Unregistering plugin 'worklists' (version 1.4.1)
W0820 23:32:28.999594 PluginsManager.cpp:168] Sample worklist plugin is finalizing
E0820 23:32:28.999623 main.cpp:1322] Uncaught exception, stopping now: [Error with the database engine] (code 11)
W0820 23:32:28.999671 main.cpp:1355] Orthanc has stopped


3. 
- once the orthanc gets superuser powers, the problem goes away, 
- once you import db schema by hand (and set the main properties), problem goes away

4. speculation: as the 

Orthanc::EmbeddedResources::GetFileResource
         (query, Orthanc::EmbeddedResources::POSTGRESQL_PREPARE_INDEX);
       db->Execute(query);

and enabling the extension are both executed within same transaction (PostgreSQLIndex.cpp), perhaps the error in the second statment terminates the transaction prematurely (i.e. failing to enable extension == failing to import schema).

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (10, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.17.9-finwe (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=pl_PL.UTF-8, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8), LANGUAGE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages orthanc-postgresql depends on:
ii  libboost-filesystem1.62.0  1.62.0+dfsg-8
ii  libboost-regex1.62.0       1.62.0+dfsg-8
ii  libboost-system1.62.0      1.62.0+dfsg-8
ii  libboost-thread1.62.0      1.62.0+dfsg-8
ii  libc6                      2.27-5
ii  libgcc1                    1:8.2.0-4
ii  libjsoncpp1                1.7.4-3
ii  libpq5                     10.5-1
ii  libstdc++6                 8.2.0-4
ii  libuuid1                   2.32.1-0.1
ii  orthanc                    1.4.1+dfsg-1
ii  zlib1g                     1:1.2.11.dfsg-1

orthanc-postgresql recommends no packages.

Versions of packages orthanc-postgresql suggests:
ii  postgresql  10+192

-- Configuration Files:
/etc/orthanc/postgresql.json changed:
{
    /**
     * Configuration to use PostgreSQL instead of the default SQLite
     * back-end of Orthanc. You will have to install the
     * "orthanc-postgresql" package to take advantage of this feature.
     * Have a look at "/usr/share/doc/orthanc-postgresql/README.Debian"
     * for a tutorial.
     **/
    "PostgreSQL" : {
        // Enable the use of PostgreSQL to store the Orthanc index?
        "EnableIndex" : true,

        // Enable the use of PostgreSQL to store the DICOM files?
        "EnableStorage" : true,

        // Option 1: Specify explicit authentication parameters
        //"Host" : "localhost",
        //"Port" : 5432,
        //"Database" : "orthanc_db",
        //"Username" : "orthanc",
        //"Password" : "edited",

        // Option 2: Authenticate using PostgreSQL connection URI
        //"ConnectionUri" : "postgresql://orthanc_user:my_password@localhost:5432/orthanc_db",
        "ConnectionUri" : "postgresql:///orthanc_db?user=orthanc",

        // Optional: Disable the locking of the PostgreSQL database
        "Lock" : false
    }
}


-- no debconf information



More information about the Debian-med-packaging mailing list