Error upgrading to Orthanc 1.3.2

Hello,

I am encountering an error in upgrading from 1.2.0 to 1.3.2:

dvproc@dicom-viewer-dev:~/radiology-viewer/osimis$ sudo docker-compose up --build

Creating network “osimis_default” with the default driver

Building orthanc

Step 1/2 : FROM osimis/orthanc:18.4.3

—> cfc764a534fe

Step 2/2 : COPY orthanc.json /etc/orthanc/

—> Using cache

—> cc5770e1bb26

Successfully built cc5770e1bb26

Successfully tagged osimis_orthanc:latest

Creating osimis_orthanc-index_1

Creating osimis_orthanc_1

Attaching to osimis_orthanc-index_1, osimis_orthanc_1

orthanc-index_1 | 2018-05-01 18:13:52.594 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432

orthanc-index_1 | 2018-05-01 18:13:52.594 UTC [1] LOG: listening on IPv6 address “::”, port 5432

orthanc-index_1 | 2018-05-01 18:13:52.598 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”

orthanc-index_1 | 2018-05-01 18:13:52.615 UTC [20] LOG: database system was shut down at 2018-05-01 18:10:01 UTC

orthanc-index_1 | 2018-05-01 18:13:52.621 UTC [1] LOG: database system is ready to accept connections

orthanc_1 | PLUGINS: Generating ‘/etc/orthanc/plugins.json’…

orthanc_1 | STORAGE: Generating ‘/etc/orthanc/storage.json’…

orthanc_1 | HTTP: Generating ‘/etc/orthanc/http.json’…

orthanc_1 | GENERAL: ‘/etc/orthanc/orthanc.json’ taking precendence over related env vars (note: file might have been generated from env vars during a previous start)

orthanc_1 | LISTENER: Generating ‘/etc/orthanc/remote-access.json’…

orthanc_1 | Startup command: Orthanc /etc/orthanc

orthanc_1 | W0501 18:13:53.020157 main.cpp:1298] Orthanc version: 1.3.2

orthanc_1 | W0501 18:13:53.021562 OrthancInitialization.cpp:168] Scanning folder “/etc/orthanc” for configuration files

orthanc_1 | W0501 18:13:53.021724 OrthancInitialization.cpp:120] Reading the configuration from: “/etc/orthanc/plugins.json”

orthanc_1 | W0501 18:13:53.022432 OrthancInitialization.cpp:120] Reading the configuration from: “/etc/orthanc/storage.json”

orthanc_1 | W0501 18:13:53.022537 OrthancInitialization.cpp:120] Reading the configuration from: “/etc/orthanc/remote-access.json”

orthanc_1 | W0501 18:13:53.022732 OrthancInitialization.cpp:120] Reading the configuration from: “/etc/orthanc/http.json”

orthanc_1 | W0501 18:13:53.022905 OrthancInitialization.cpp:120] Reading the configuration from: “/etc/orthanc/orthanc.json”

orthanc_1 | W0501 18:13:53.050019 main.cpp:671] Loading plugin(s) from: /usr/share/orthanc/plugins

orthanc_1 | W0501 18:13:53.050106 OrthancInitialization.cpp:1004] SQLite index directory: “/var/lib/orthanc/db”

orthanc_1 | E0501 18:13:53.050521 main.cpp:1324] Uncaught exception, stopping now: [SQLite: Unable to open the database] (code 1002)

orthanc_1 | W0501 18:13:53.050791 main.cpp:1357] Orthanc has stopped

osimis_orthanc_1 exited with code 255

It appears that SQLite can’t open the database created under 1.2.0. Is there a know SQLite incompatibility? I can successfully start the 1.2.0 version again, so the SQLite DB is basically intact.

I am using the following docker-compose.yml:

version: “2”
services:
orthanc:
build: orthanc
depends_on: [orthanc-index]
restart: unless-stopped
#ports: [“104:4242”, “8042:8042”]
ports: [“8042:8042”]
volumes: [“/mnt/disks/orthanc-db/storage:/var/lib/orthanc/db:Z”]

orthanc-index:

image: postgres
restart: unless-stopped
volumes: [“/mnt/disks/orthanc-index/postgresql/data:/var/lib/postgresql/data:Z”]

Thanks in advance for your help,
Bill

Orthanc/SQLite seems to have failed because the disk holding the SQLite DB was attached as readonly. (I did this so that I could share the disk with another VM for testing, etc. Apparently SQLite in Orthanc 1.2.0 did not need to do any writes to the disk.). Making the disk read-write allowed Orthanc to start but it doesn’t see any of the data in the DB…the list of patients reported by Explorer is empty.

(BTW, I’ve been using osimis/orthanc:17.6.1 docker image, trying to move to osimis/orthanc:18.4.3 for newer Orthanc components.)

Next I allowed Orthanc 1.3.2 and Postgresql to create new DBs, and was able to load DICOM files, I could see the patients/studies/etc in Explorer, and could view loaded studies in Osiris viewer.
However, when I switched back to Orthanc 1.2.0, Explorer no longer showed any patients.

Bill

I’m totally lost between your setups. The docker-compose.yml you shared is starting a PG container but you say you’re using SQlite.
In the second email, you seem to be switching from SQlite to PG … in this case, you should not expect to find your data back. These are completely incompatible DB.

If you want to upgrade from Sqlite to PG, you need to replicate the old Orthanc into the new Orthanc following these instructions: http://book.orthanc-server.com/users/replication.html

Alain,

I’m following the installation/configuration recommended here (with some modifications), which only uses PG for the index. Sorry, I should have included my orthanc.json. Not that PostgreSQL/EnableStorage is false:

{
“Name”: “isb-cgc”,
“DicomAet”: “ISB-CGC”,
“HttpPort” : 8042,
“PostgreSQL”: {
“EnableIndex”: true,
“EnableStorage”: false,
“Host”: “orthanc-index”,
“Database”: “postgres”,
“Username”: “postgres”
},
“WebViewer” : {
“CachePath” : “/var/lib/orthanc/cache”,
“CacheSize” : 10,
“Threads” : 4,
“EnableGdcm” : false,
//Don’t show the ‘Download Study’ button
“StudyDownloadEnabled”: false
}
}

Let me try to add some additional clarification:
The “volumes: [”/mnt/disks/orthanc-db/storage:/var/lib/orthanc/db:Z"]" line in docker-compose.yml results in /var/lib/orthanc/db being mapped to an attached disk. I originally attached it read-write so that Orthanc could populate the DICOM files there, then re-attached it read-only. As I said above, I had it attached read-only because I wanted to be able to share this disk with another VM running Orthanc for various internal uses. Orthanc 1.2.0 functions as expected when the disk is read-only; this suggests that when Orthanc 1.2.0 is started, it does not try to write to that disk.

In trying to move to 1.3.2, I used the same docker-compose.yml and orthanc.json as for 1.2.0, and only changed the Dockerfile:

#FROM osimis/orthanc:17.6.1
FROM osimis/orthanc:18.4.3
COPY orthanc.json /etc/orthanc/

The first problem that I encountered was due to the disk being read-only. Once I reattached the disk as read-write, Orthanc 1.3.2 could start. Doing an ls -l on /mnt/disks/orthanc-db/storage shows that Orthanc 1.3.2 created two files, index-shm and index-wal, on startup:

$ ls -l /mnt/disks/orthanc-db/storage

total 1164

drwxr-xr-x 258 root root 4096 Apr 10 16:01 00

drwxr-xr-x 258 root root 4096 Apr 10 15:56 01

:

:

drwxr-xr-x 258 root root 4096 Apr 10 15:59 fe

drwxr-xr-x 258 root root 4096 Apr 10 18:12 ff

-rw-r–r-- 1 root root 106496 May 2 00:09 index

-rw-r–r-- 1 root root 32768 May 2 15:56 index-shm

-rw-r–r-- 1 root root 0 May 2 15:56 index-wal

These files seem to be deleted when orthanc 1.3.2 is stopped. Orthanc 1.2.0 does not create such files. This explains why Orthanc 1.3.2 could not start when the disk was read-only.

Again, even though Orthanc 1.3.2. now starts, Orthanc Explorer does not show any patients.

My statement “Next I allowed Orthanc 1.3.2 and Postgresql to create new DBs, and was able to load DICOM files” meant that I changed docker-compose.yml to:

version: “2”
services:
orthanc:
build: orthanc
depends_on: [orthanc-index]
restart: unless-stopped
#ports: [“104:4242”, “8042:8042”]
ports: [“8042:8042”]
volumes: [“/mnt/disks/orthanc-db/storage1:/var/lib/orthanc/db:Z”]

orthanc-index:

image: postgres
restart: unless-stopped
volumes: [“/mnt/disks/orthanc-index/postgresql1/data:/var/lib/postgresql/data:Z”]

That is, I change “storage” to “storage1” and “postgresql” to “postgresql1”, which caused Orthanc 1.3.2 and PG to create empty DBs, which I then populated with a DICOM files for a few patients. Orthanc Explorer listed these patients as expected and Osimis could be used to view patient studies. However, Orthanc Explorer showed no patients when I ran Orthanc 1.2.0 against these new DBs.

So… I’m confident that I could recreate the DBs under Orthanc 1.3.2, and I will if it comes to that, but I’ve got about 600-700GB of DICOM files loaded, and it does take some time to reload that much data. The bigger question, though, is this apparent incompatibility between Orthanc versions. And since I haven’t seen others report a similar problem, I have to wonder if there is something that I am doing incorrectly.

Thanks as always,
Bill

Hello,

The database schema has not changed since Orthanc 0.9.5, which implies that Orthanc 1.3.2 is fully compatible with Orthanc 1.2.0 (no action is to be taken to update the database):
http://book.orthanc-server.com/developers/db-versioning.html

If you see the files “index”, “index-shm” and “index-wal” being created, this indicates that your are not using the PostgreSQL Index plugin. As a consequence, you do not see the files that were stored in PostgreSQL using your Orthanc 1.2.0.

This is because your configuration file does not contain the “Plugins” directive, which implies that no plugin is loaded (even though “EnableIndex” is set to “true”). Carefully read the Orthanc log, and make sure the “PostgreSQLIndex” plugin is actually loaded.

HTH,
Sébastien-

Thanks Sébastien. I’d realized this just before you responded :-).

BTW, why are there both jodogne and osimis dockerhub repos for orthanc, etc. ?

Bill

Dear Bill,

The “jodogne/orthanc” and “jodogne/orthanc-plugins” repos are always kept in sync with the latest releases of the Orthanc project, with a basic configuration system that is inherited from the Debian packages (i.e. manual edit of configuration files):
http://book.orthanc-server.com/users/docker.html

The “osimis/…” repos are used by the technical team of Osimis in order to provide professional support to their customers, with a configuration system that can be tuned through environment variables (which is very handy if using docker-compose). These repos are not necessarily always in sync with the Orthanc project, but they also include plugins edited by Osimis, notably the Osimis Web viewer (that is much more advanced than the Orthanc Web viewer) and the advanced authorization plugin:
http://book.orthanc-server.com/plugins.html#from-osimis

HTH,
Sébastien-

Hello,

I am getting similar error but on my linux vm.
commands below I used to install and start Orthanc On linux VM,
I installed Orthanc On Linux VM with : - sudo apt-get install orthanc.

To start Orthanc : - sudo /etc/init.d/orthanc start
To generate Log :- sudo -u orthanc /usr/sbin/Orthanc --verbose /etc/orthanc/ > Orthanc.log 2>&1 (generates log Orthanc.log file)

In logs showing below ERROR
E1110 08:14:13.666063 main.cpp:1462] Uncaught exception, stopping now: [SQLite: Cannot prepare a cached statement] (code 1012)
W1110 08:14:13.666173 main.cpp:1495] Orthanc has stopped.

Thanks.!

Hello,

You are running 2 instances of Orthanc on the same database:

  • First instance of Orthanc: “sudo /etc/init.d/orthanc start”
  • Second instance of Orthanc: “sudo -u orthanc /usr/sbin/Orthanc --verbose /etc/orthanc/”

If you want to generate a log trace, stop the first instance of Orthanc by typing “sudo /etc/init.d/orthanc stop”, then start the second instance.

Sébastien-