Bug 217

Summary: Folder indexer crashing when in the folder there's a 7GB file
Product: Orthanc Reporter: telari7455
Component: Plugin - OtherAssignee: telari7455
Status: CONFIRMED ---    
Severity: normal CC: s.jodogne
Priority: ---    
Version: unspecified   
Hardware: Macintosh   
OS: Mac OS   

Description telari7455 2023-08-29 13:03:29 CEST
I have a folder with a single 7GB file that causes the indexer plugin to crash. The 7GB file is not a DICOM file so presumably it should not crash. Note that the size is about the size of my RAM allocated.
Comment 1 telari7455 2023-08-29 13:07:52 CEST
Latest indexer cloned with "hg clone <indexer mercurial link>". Orthanc 12.2
Comment 2 telari7455 2023-08-29 13:27:29 CEST
I experimentally determined that the exact way of crashing is that if the file size is greater than RAM size PLUS the swap size then on Ubuntu the exact error message is just "Killed". Which means that somewhere there is "malloc(entire_file_size)" which then crashes
Comment 3 telari7455 2023-08-29 13:30:32 CEST
The culprit

https://orthanc.uclouvain.be/hg/orthanc-indexer/file/4bde2c2dc03c/Sources/Plugin.cpp#l102

I think it'd be nice to have it in the TODO to use mmap or something else to do this check without loading the whole file
Comment 4 telari7455 2023-08-29 19:54:51 CEST
I self-assign this
Comment 5 Sébastien Jodogne 2023-12-20 12:17:48 CET
For reference, this issue is related to the following discussion on Discourse:
https://discourse.orthanc-server.org/t/patch-for-orthanc-indexer-plugin-crashing-on-big-non-dicom-files/3849/7