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) #320

Open
ranasrule opened this issue Nov 30, 2022 · 10 comments

Comments

@ranasrule
Copy link

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" . this error doesn't occur on small series but rather large ones with approximately 500+ instances and a size of 350+ mb. 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
Copy link
Author

anyone?

@pieper
Copy link
Contributor

pieper commented Dec 2, 2022

"Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED" . this error doesn't occur on small series but rather large ones with approximately 500+ instances and a size of 350+ mb.

It sounds like you've simply run out of memory. That series is probably just too big to view in the browser. It would be good to define the practical limit cornerstone can support but I'm sure there are many variables that need to be taken into account. At the least there should be better error handling.

@ranasrule
Copy link
Author

ranasrule commented Dec 2, 2022

"Uncaught (in promise) Error: CACHE_SIZE_EXCEEDED" . this error doesn't occur on small series but rather large ones with approximately 500+ instances and a size of 350+ mb.

It sounds like you've simply run out of memory. That series is probably just too big to view in the browser. It would be good to define the practical limit cornerstone can support but I'm sure there are many variables that need to be taken into account. At the least there should be better error handling.

Thank you for your reply. It's there no way to increase the limit? I have more than enough free RAM so that probably isn't the issue. The studies open just fine but this error appears once MPR generation is triggered. Why is the issue only triggered by MPR? Don't have any such issues with OHIF v2 with the same studies.

@pieper
Copy link
Contributor

pieper commented Dec 2, 2022

MPR relies on the GPU so there's a finite limit in the hardware, plus the browser may impose additional limits. Both of these would be outside the control of the web application. Maybe even outside the control of the user, depending on the browser / OS.

@ranasrule
Copy link
Author

MPR relies on the GPU so there's a finite limit in the hardware, plus the browser may impose additional limits. Both of these would be outside the control of the web application. Maybe even outside the control of the user, depending on the browser / OS.

But that begs the question (at least from my side) why isn't the issue occurring in OHIF v2.

@pieper
Copy link
Contributor

pieper commented Dec 2, 2022

That's definitely worth debugging. If it is a GPU issue then this tool might help: https://spector.babylonjs.com/

@ranasrule
Copy link
Author

MPR relies on the GPU so there's a finite limit in the hardware, plus the browser may impose additional limits. Both of these would be outside the control of the web application. Maybe even outside the control of the user, depending on the browser / OS.

What about the code below

https://github.com/cornerstonejs/cornerstone3D-beta/blob/b80ea407eaa59da10fe06d0794b0356416410fdc/packages/core/src/cache/cache.ts#L41

Isn't the cache size being set in this code?

@ranasrule
Copy link
Author

ranasrule commented Dec 3, 2022

That's definitely worth debugging. If it is a GPU issue then this tool might help: https://spector.babylonjs.com/

I really have zero expertise in JS so I really cant be of much help here. For what its worth I really think this is a huge issue as in the real world study sizes are only getting larger and larger day by day. Im unable to use MPR in OHIF v3 on almost 90% of the studies Im dealing with. Hopefully you guys will look into this as it makes an otherwise very promising new version very crippled. I mean you guys did MPR well on v2 so its a bummer its not working in v3 for large studies.

@ranasrule
Copy link
Author

MPR relies on the GPU so there's a finite limit in the hardware, plus the browser may impose additional limits. Both of these would be outside the control of the web application. Maybe even outside the control of the user, depending on the browser / OS.

What about the code below

https://github.com/cornerstonejs/cornerstone3D-beta/blob/b80ea407eaa59da10fe06d0794b0356416410fdc/packages/core/src/cache/cache.ts#L41

Isn't the cache size being set in this code?

@pieper cant the cache size be manipulated here ?

@ranasrule
Copy link
Author

can anyone offer any help?

wayfarer3130 pushed a commit that referenced this issue Jan 20, 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

2 participants