Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPR generation fails ("Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED" error in browser console) #3038

Closed
ranasrule opened this issue Nov 24, 2022 · 24 comments

Comments

@ranasrule
Copy link

ranasrule commented Nov 24, 2022

On the latest version of OHIF V3 MPR generation fails with the following error in the browser console "Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED" . Im running OHIF in Nginx v1.23.2. Im posting my Nginx config file, OHIF app-config.js contents files below:

Untitled

app-config.js

window.config = {
    routerBasename: "/",
    extensions: [],
    modes: [],
    showStudyList: !0,
    maxNumberOfWebWorkers: 4,
    omitQuotationForMultipartRequest: !0,
    showLoadingIndicator: !0,
    maxNumRequests: {
        interaction: 100,
        thumbnail: 75,
        prefetch: 10
    },
    dataSources: [{
        friendlyName: "dcmjs DICOMWeb Server",
        namespace: "@ohif/extension-default.dataSourcesModule.dicomweb",
        sourceName: "dicomweb",
        configuration: {
            name: 'Orthanc',
	    wadoUriRoot: '/orthanc/wado',
	    qidoRoot: '/orthanc/dicom-web',
	    wadoRoot: '/orthanc/dicom-web',
            qidoSupportsIncludeField: !1,
            imageRendering: "wadors",
            thumbnailRendering: "wadors",
            enableStudyLazyLoad: !0,
            supportsFuzzyMatching: !1,
        }
    }, {
        friendlyName: "dicom json",
        namespace: "@ohif/extension-default.dataSourcesModule.dicomjson",
        sourceName: "dicomjson",
        configuration: {
            name: "json"
        }
    }, {
        friendlyName: "dicom local",
        namespace: "@ohif/extension-default.dataSourcesModule.dicomlocal",
        sourceName: "dicomlocal",
        configuration: {}
    }],
    httpErrorHandler: e => {
        console.warn(e.status), console.warn("test, navigate to https://ohif.org/")
    },
    defaultDataSourceName: "dicomweb",
    hotkeys: [{
        commandName: "incrementActiveViewport",
        label: "Next Viewport",
        keys: ["right"]
    }, {
        commandName: "decrementActiveViewport",
        label: "Previous Viewport",
        keys: ["left"]
    }, {
        commandName: "rotateViewportCW",
        label: "Rotate Right",
        keys: ["r"]
    }, {
        commandName: "rotateViewportCCW",
        label: "Rotate Left",
        keys: ["l"]
    }, {
        commandName: "invertViewport",
        label: "Invert",
        keys: ["i"]
    }, {
        commandName: "flipViewportHorizontal",
        label: "Flip Horizontally",
        keys: ["h"]
    }, {
        commandName: "flipViewportVertical",
        label: "Flip Vertically",
        keys: ["v"]
    }, {
        commandName: "scaleUpViewport",
        label: "Zoom In",
        keys: ["+"]
    }, {
        commandName: "scaleDownViewport",
        label: "Zoom Out",
        keys: ["-"]
    }, {
        commandName: "fitViewportToWindow",
        label: "Zoom to Fit",
        keys: ["="]
    }, {
        commandName: "resetViewport",
        label: "Reset",
        keys: ["space"]
    }, {
        commandName: "nextImage",
        label: "Next Image",
        keys: ["down"]
    }, {
        commandName: "previousImage",
        label: "Previous Image",
        keys: ["up"]
    }, {
        commandName: "setToolActive",
        commandOptions: {
            toolName: "Zoom"
        },
        label: "Zoom",
        keys: ["z"]
    }, {
        commandName: "windowLevelPreset1",
        label: "W/L Preset 1",
        keys: ["1"]
    }, {
        commandName: "windowLevelPreset2",
        label: "W/L Preset 2",
        keys: ["2"]
    }, {
        commandName: "windowLevelPreset3",
        label: "W/L Preset 3",
        keys: ["3"]
    }, {
        commandName: "windowLevelPreset4",
        label: "W/L Preset 4",
        keys: ["4"]
    }, {
        commandName: "windowLevelPreset5",
        label: "W/L Preset 5",
        keys: ["5"]
    }, {
        commandName: "windowLevelPreset6",
        label: "W/L Preset 6",
        keys: ["6"]
    }, {
        commandName: "windowLevelPreset7",
        label: "W/L Preset 7",
        keys: ["7"]
    }, {
        commandName: "windowLevelPreset8",
        label: "W/L Preset 8",
        keys: ["8"]
    }, {
        commandName: "windowLevelPreset9",
        label: "W/L Preset 9",
        keys: ["9"]
    }]
};

nginx.conf


worker_processes  5;

events {
    worker_connections  4096;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    proxy_connect_timeout 3200s;
	proxy_read_timeout 3000s;
    #gzip  on;

    server    {
       
        listen 8099;
        server_name default_server;
       
		location / {
			try_files $uri $uri/ /index.html;
			add_header 'Access-Control-Allow-Credentials' 'true';
            add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
            add_header 'Access-Control-Allow-Origin' '*';
			add_header 'Cross-Origin-Opener-Policy' 'same-origin';
			add_header 'Cross-Origin-Embedder-Policy' 'require-corp';
				  }
				  
        location /orthanc/{
        
            proxy_pass http://localhost:8042;
            proxy_set_header Authorization "Basic YWxuYXNhcnBhY3M6YWxuYXNhcnBhY3M1Nzc=";
            proxy_set_header HOST $Host:8099/orthanc/;
            proxy_set_header X-Real-IP $remote_addr;

            rewrite /orthanc(.*) $1 break;

            

        }
       
    }

}
@ranasrule ranasrule changed the title MPR generation fails (Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED error in browser console) MPR generation fails ("Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED" error in browser console) Nov 24, 2022
@ranasrule
Copy link
Author

ranasrule commented Nov 25, 2022

this error doesn't occur on small series but rather large ones with approximately 500+ instances and a size of 350+ mb

any help would be appreciated @Georift @pieper

@ranasrule
Copy link
Author

Anyone?

@Georift
Copy link
Contributor

Georift commented Nov 28, 2022

I think there will always be a tension between how well OHIF can manage the memory of large scans, and what the upper limit is of the browser. I'm not as deeply versed on the OHIF codebase, so maybe some others will have some recommendations.

Just a thought, it looks as if you're running Firefox? Could you also try on other browsers see if the issue occurs at the same point in the loading?

@ranasrule
Copy link
Author

I think there will always be a tension between how well OHIF can manage the memory of large scans, and what the upper limit is of the browser. I'm not as deeply versed on the OHIF codebase, so maybe some others will have some recommendations.

Just a thought, it looks as if you're running Firefox? Could you also try on other browsers see if the issue occurs at the same point in the loading?

I've tried on Firefox, Chrome and Edge and gotten the same results. The issue occurs immediately after the MPR button is pressed.

@Georift
Copy link
Contributor

Georift commented Nov 28, 2022

Perhaps you can share a zip with the images that caused this crash. Along with some system specs of the machine that you're running it on. Might help someone if they come across this issue and have time to dig into it?

@ranasrule
Copy link
Author

Perhaps you can share a zip with the images that caused this crash. Along with some system specs of the machine that you're running it on. Might help someone if they come across this issue and have time to dig into it?

The machine has good specs ie i7 7th gen processor with 32gb ram. I can provide a study in private to you if you can provide your contact info.

@ranasrule
Copy link
Author

ranasrule commented Nov 29, 2022

Would one of the devs please look into this? Its a pretty major issue. About 90% of the studies in our 4.7tb study archive are affected by this issue so its not like its an isolated edge-case type of problem.

@pieper @fedorov @swederik @rodrigoea @dannyrb @sedghi

@Georift
Copy link
Contributor

Georift commented Nov 30, 2022

Hi @ranasrule, not the greatest etiquette to go tagging everyone indiscriminately in the project.

Perhaps you can dive into this issue a little more yourself, this method looks interesting.

@ranasrule
Copy link
Author

Hi @ranasrule, not the greatest etiquette to go tagging everyone indiscriminately in the project.

Perhaps you can dive into this issue a little more yourself, this method looks interesting.

Im really not much of a JS developer but If I play around with this code how will it integrate into the OHIF v3 stable branch code that I use to build OHIF viewer ? The code you pointed to is in a totally different repo.

@ranasrule
Copy link
Author

Perhaps you can share a zip with the images that caused this crash. Along with some system specs of the machine that you're running it on. Might help someone if they come across this issue and have time to dig into it?

If I send you one of the studies causing this issue would you be willing to look into it?

@sedghi
Copy link
Member

sedghi commented Mar 5, 2023

before doing that can you take a look at #3207

@ranasrule
Copy link
Author

before doing that can you take a look at #3207

thank you for the reply. I tried all possible solutions outlined in the link you provided....still the same error no matter which ANGLE I use

gg

@sedghi
Copy link
Member

sedghi commented Mar 6, 2023

probably your series is quite big that can't go MPR

@ranasrule
Copy link
Author

probably your series is quite big that can't go MPR

there is a limit in OHIF to how big a study can be?

@sedghi
Copy link
Member

sedghi commented Mar 6, 2023

No limit, but for MPR seems like the cache is being full, maybe try increasing the cache limit too
cornerstone.cache.setMaxCacheSize(...)

@sedghi
Copy link
Member

sedghi commented Mar 6, 2023

MPR hols the stack viewport images, because usually it needs to go back to stack, so I guess the images load, but then the volume with same number of slices fail, maybe increasing our cache from 1GB to 2GB solves the issue for you

@ranasrule
Copy link
Author

MPR hols the stack viewport images, because usually it needs to go back to stack, so I guess the images load, but then the volume with same number of slices fail, maybe increasing our cache from 1GB to 2GB solves the issue for you

so how do I go about increasing the cache size? is there an option in the app-config.js file?

@sedghi
Copy link
Member

sedghi commented Mar 7, 2023

you should do it inside the extensions/cornerstone/src/init.tsx with cornerstone.cache.setMaxCacheSize(...)

@ranasrule
Copy link
Author

you should do it inside the extensions/cornerstone/src/init.tsx with cornerstone.cache.setMaxCacheSize(...)

So just do the following?

change

const MAX_CACHE_SIZE_1GB = 1073741824;
  const maxCacheSize = appConfig.maxCacheSize;
  cornerstone.cache.setMaxCacheSize(
    maxCacheSize ? maxCacheSize : MAX_CACHE_SIZE_1GB
  );

to


const MAX_CACHE_SIZE_2GB = 2147483648;
  const maxCacheSize = appConfig.maxCacheSize;
  cornerstone.cache.setMaxCacheSize(
    maxCacheSize ? maxCacheSize : MAX_CACHE_SIZE_2GB 
  );

@sedghi
Copy link
Member

sedghi commented Mar 7, 2023

oh seems like we already have a config key for it, so just add maxCacheSize in your config and set it to 2GB, if it can't do 1.8 GB or so

@ranasrule
Copy link
Author

oh seems like we already have a config key for it, so just add maxCacheSize in your config and set it to 2GB, if it can't do 1.8 GB or so

ok....do I set in GB or Bytes ?

@sedghi
Copy link
Member

sedghi commented Mar 7, 2023

Bytes

@hwanython
Copy link

Hi, ranasrule

is that solved?

@sedghi
Copy link
Member

sedghi commented Oct 13, 2023

Maybe your GPU doesn't have enough memory. You can give it a shot by turning on the 16-bit texture and see if it helps reduce the memory usage on your GPU and RAM. Just keep in mind that not all hardware might support this feature. You can check the webgl2 report to find out more about it.

use16BitDataType

@sedghi sedghi closed this as completed Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants