How to make sure resources are available to start a machine?

I am having repeated trouble starting machines. The API tells me that:

... ams [info] Starting machine
... ams [error] machines API returned an error: "could not reserve resource for machine: insufficient memory available to fulfill request"

Starting machines on demand is mission-critical to my use case though.

Is there a way to make sure the necessary resources are available to start a machine on demand?
Maybe by some sort of polling for resources in specific regions? Maybe by “reserving” them with idle machines killed on-demand when a new machine needs to be started? Or by other means?

It has been at least an hour now that I can’t update a machine. I am talking to the API with curl and consistently getting the response:
{"error":"aborted: could not reserve resource for machine: insufficient memory available to fulfill request"}
I tried changing the region setting in the request but it makes no difference :frowning:

Hi! Are you using the Machines API directly? If so, perhaps you can mimic what flyctl started doing recently - if upgrading a machine (which is usually done in place, which tries to allocate the resources on the same worker where the machine is currently hosted) doesn’t work due to lack of resources, then the machine is replaced instead; this has a better chance of succeeding because it won’t be constrained to the same host (unless you’re using a volume).

The logic flyctl uses to do so is here.

  • Daniel
1 Like

Thank you for your reply.

I solved the situation by destroying and recreating with a different machine name. By the way, it seems to take a while for fly to free the name of the destroyed machine so another created machine can take the same name…

Anyway, what is more important: Is there a way to make sure the necessary resources are available to start a machine on demand?
Maybe by some sort of polling for resources in specific regions? Maybe by “reserving” them with idle machines killed on-demand when a new machine needs to be started? Or by other means?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.