anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: 8b461c5bc7

What I’m trying to do:
Im running scheduled background tasks that suddenly all fail with:
anvil.server.ExecutionTerminatedError: Server code exited unexpectedly: 8b461c5bc7

What I’ve tried and what’s not working:
Tried to run them via console with anvil.server.launch_background_tasks. That works fine. Its just the scheduled ones that are failing.

Hey @jonas,

Welcome to the forum!

My initial thought was that there is some difference between your debug environment and the published environment that could be causing the difference between the scheduled and console entry points.

There can be lots of little things that create differences between the environments which make the console (which are debug) to behave differently than Published.

  • Is the published app on a different branch?
  • is the published app tied to a specific commit?
  • Are you using Uplink? Which environment is it connected to?
  • Any Google integration that utilizes API keys?

You could try switching which environment the scheduled tasks run in to help diagnose. The other thing is to add some good debug information to your background task and check the background task logs.

1 Like

Hey!

The published app is pointing to master latest. So does the debug environment. I only have this one environment (I think on non business plans there can only be one?)
I use uplink, but not to run the background function (used the online interface to do that while testing) and it’s not using a different environment.
I dont use any google integration.

I also have a very weird behavior, as of this morning, the scheduled function doesnt run at all anymore. logs dont show it triggered and in the background tasks overview it just says “last run 4 hours ago”. I did not change anything this morning.

@jonas That error usually means the server is running out of memory. Since you are running multiple scheduled background tasks at the same time, they may be exhausting the available memory. I would suggest combining the background tasks into a single background task that runs everything sequentially.

1 Like