Forums

PyOCC REST API intermittent failure on PythonAnywhere

I have been struggling with getting my Flask based Three.js app to work in a stable manner on PythonAnywhere. I am running an OpenCASCADE CAD backend which basically does some geometric computations on 3D objects, and JSON's are pushed back and forth from the frontend to update the geometry in the Three.js canvas. When I run the app locally, it works perfectly fine with no intermittent errors. However, if I use my PythonAnywhere backend for the geometric computation, it fails most of the times and then may suddenly worrk.

I use retries on both my frontend as well as backend code. Sometimes it works after a few tries, sometimes it doesn't need to retry at all and works great, and sometimes it just doesn't happen.

Does it have something to do with memory limitations? Maybe some limits on heavy computation? The retrieval of the source geometry from AWS works fine as I have verified it.

You may try it for yourself at https://farhan3d.pythonanywhere.com/cad_sandbox. Just select the cylinder, then the box, type 's' in the console and press Enter.

Do you see any errors in your web app's log when it fails?