I’ve implemented custom authentication and authorization mechanisms to control access to Orthanc resources using the RegisterIncomingHttpRequestFilter callback method. Everything works fine locally, but after deployment, Orthanc crashes after some time and requires a restart to function again.
The custom authentication mechanism works perfectly on my local machine.
After deploying Orthanc to a server, it runs fine for a while, but after some time, Orthanc fails and stops responding. Restarting the service makes it work again temporarily.
Even with the simplified filter function (return True without any real authentication logic), Orthanc crashes over time
The orthanc.RegisterOnChangeCallback(on_change) function works fine in both local and production environments.
There are no specific error logs that indicate the cause of the crash.
but i noticed a logs as,
E1002 02:57:33.487136 PluginsManager.cpp:153] Exception in database back-end: Database could not serialize access due to concurrent update, the transaction should be retried
version details:
Orthanc Version:orthancteam/orthanc:23.11.0
Pyhton Plugin Version : 4.1
Added logs to track when the Filter methods are triggered, but that hasn’t led to finding the root cause yet
Any insights, suggestions, or guidance on how to further debug or resolve this would be greatly appreciated!
This is actually a false error message. the transaction is actually retried.
I must admit that I’m quite clueless on this one. I would of course check the verbose logs to know what Orthanc was doing when it crashed and I would also monitor the memory usage of the container in case there is a memory leak somewhere (there are no know leaks in Orthanc but the python code might introduce some).
Upgrading to latest version is also always a good idea before starting any kind of investigations.
Hi Alain
Thanks for the response, like you said I’ve checked the latest version, and it looks like this issue is resolved there. However, I have some concerns about upgrading:
Current Setup:
We’re currently running Orthanc version 23.11.0 with around 32,000 studies in the database.
I noticed that the latest version introduces schema changes.
My Questions:
1)Will upgrading to the latest version result in data loss?
I’m worried about losing our existing studies due to schema changes. How does Orthanc handle data migration during upgrades with schema modifications?
2)What is the best way to migrate data properly?
3)Are there any recommended steps to ensure a safe upgrade?
Any guidance or advice from others who have done this type of upgrade would be greatly appreciated!
Actually, in general, you should not worry about the upgrades, Orthanc will handle it for you. The main schema version (v 6) has not changed since December … 2015 ;-).
Some Orthanc upgrade might introduce small modifications in the DB schema. If you are using SQLite, there’s nothing to worry about. If you are using PostgreSQL and have very large DBs and multiple Orthanc instances connected to the same DB, you should read this section of the documentation to make sure your downtime is minimized.
Hi Alain
Thanks for the insights! I have one more question:
What happens to incoming studies during the upgrade process?
If studies are sent to Orthanc during the upgrade, is there a risk of losing those studies?
Should we plan to stop incoming data temporarily, or are there any best practices to manage this?
Orthanc will actually upgrade the DB during its startup before the DICOM and HTTP Ports are opened. Therefore, clients will not be able to connect and push new studies.