changeset 41:eb6edb022a00

fix transfer error
author Alain Mazy <am@osimis.io>
date Tue, 12 Jul 2022 15:07:31 +0200
parents 1256194e1c08
children b4650bef03ac c3fefbb11321
files Framework/OrthancInstancesCache.cpp NEWS TODO
diffstat 3 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/OrthancInstancesCache.cpp	Tue Jul 12 12:43:43 2022 +0200
+++ b/Framework/OrthancInstancesCache.cpp	Tue Jul 12 15:07:31 2022 +0200
@@ -20,6 +20,7 @@
 #include "OrthancInstancesCache.h"
 
 #include <Compatibility.h>  // For std::unique_ptr
+#include <Logging.h>
 
 namespace OrthancPlugins
 {
@@ -246,6 +247,7 @@
       CacheAccessor accessor(*this, instanceId);
       if (accessor.IsValid())
       {
+        // keeping this log for future (see TODO) LOG(INFO) << "++++ Chunk for " << instanceId << " is in cache";
         accessor.GetChunk(chunk, md5, offset, size);
         return;
       }
@@ -253,10 +255,11 @@
       
     // The instance was not in the cache, load it
     std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
-    instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize());
+    instance->GetChunk(chunk, md5, offset, size);
 
     // Store the just-loaded DICOM instance into the cache
     {
+      // keeping this log for future (see TODO) LOG(ERROR) << "---- Chunk for " << instanceId << " not in cache -> adding it";
       boost::mutex::scoped_lock lock(mutex_);
       Store(instanceId, instance);
     }
--- a/NEWS	Tue Jul 12 12:43:43 2022 +0200
+++ b/NEWS	Tue Jul 12 15:07:31 2022 +0200
@@ -3,6 +3,11 @@
 
 => Minimum SDK version: 1.5.0 <=
 
+* improved error reporting
+* fixed transfer error occuring when the resources to transfer did not fit inside the
+  plugin cache (512 MB by default).  The error generated high CPU usage on the sending side
+  while compressing large files instead of a simple bucket and in NetworkProtocolError
+  on the receiving side.
 
 Version 1.1 (2022-06-22)
 ========================
--- a/TODO	Tue Jul 12 12:43:43 2022 +0200
+++ b/TODO	Tue Jul 12 15:07:31 2022 +0200
@@ -4,3 +4,20 @@
 * Decide whether we should also duplicate the metadata from the local
   Orthanc server to the remote Orthanc server:
   https://groups.google.com/g/orthanc-users/c/YV_1HPRaPfo
+
+* if only one large instance (600MB) to transfer and 4 workers, all 4 workers will request the
+  instances to Orthanc and try to store it in cache:
+  I0712 13:32:46.345502 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
+  I0712 13:32:46.629497 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
+  I0712 13:32:46.925776 FilesystemStorage.cpp:161] Reading attachment "5c10c59c-8d62-4cac-91da-5511d1634dc0" of "DICOM" content type
+  --- extra logs ---- E0712 13:32:52.562947 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
+  --- extra logs ---- E0712 13:32:52.810866 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
+  --- extra logs ---- E0712 13:32:53.120938 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
+  --- extra logs ---- E0712 13:32:53.385318 PluginsManager.cpp:153] ---- Chunk for 7db35096-825b48a0-55ae8186-c08858a9-328771e1 not in cache -> adding it
+  I0712 13:33:34.338833 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/32 (timeout: 60s)
+  I0712 13:33:34.879165 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/30 (timeout: 60s)
+  I0712 13:33:36.146970 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/33 (timeout: 60s)
+  I0712 13:33:36.929801 HttpClient.cpp:835] (http) New HTTP request to: http://127.0.0.1:8044//transfers/push/cbd4d5d2-46eb-4bbf-aad5-e231c87920fa/31 (timeout: 60s)
+  -> cache should handle a list of "instances being loaded" and have 3 workers wait for it to become available
+
+  
\ No newline at end of file