Uplink Disconnects caused by RAM limit?

I’m calling a server function over Uplink that runs a machine learning model, but every time I do this call, the Uplink disconnects after about a minute. I have tried adding anvil.server.wait_forever() to the server script, and I have confirmed that the server runtime is still going even after the Uplink Disconnect error. I ran into something similar while developing this model on Google Collab and it turned out to be cause by hitting a RAM limit. Is there a RAM limit when running functions in an app through anvil.server.call?

Think this might answer my question: File Upload Size Limits using data tables - #2 by campopianoa

Is there a workaround for the 1GB RAM limit? According to Google Collab, running my model requires about 1.29GB of RAM. If the 1GB is a hard limit, that would unfortunately mean that Anvil isn’t a workable platform for my app.

Where are you trying to run the model, in an Uplink script or in a server module?

The model is run in an Uplink through anvil.server.call. The app always disconnects while waiting for the return from the uplink function. I cut the model’s RAM usage and run time by running it on a smaller sample of the data, and that works. So I could do a sort of ‘demo’ app, but this still won’t work for my full idea.

Could you share a screenshot of the actual error message? And where is the Uplink running?

Right now, it sounds like a limitation of your machine rather than an Anvil limitation, but some more specifics might help us figure out the issue.

Here is the error:
Picture1

The full text is anvil.server.UplinkDisconnectedError: Uplink disconnected at Form1, line 62. Line 62 is where I call my model. But I still don’t think it’s a limitation of the machine. The Uplink is running on a Google Collab notebook, and I adapted the model to run right inside the notebook. That outputs just fine.

However, the notebook clearly disconnects from Anvil during the model run. See below. It says it reconnects, but that doesn’t seem to matter when calling the function from the app. It just disconnects and stops the app right there.

Also, when I run on a sample of 10000 vs 30000, there is no disconnect at all. Here is the output with the smaller sample:

Does the model run fine on the 30000 sample directly in the Notebook (without connecting to Anvil)?

1 Like

Yes, the images above are what I get when running the model in the Notebook.

Mhm, I see. Could you provide a clone link for this app, so I can take a closer look at what it’s trying to do? Is it the same clone link as in this thread?