Debug Error 409 CONFLICT

I need some help debugging a MaaS related issue with Juju. Juju is trying to deploy a machine with certain constraints and MaaS returns the following error:

Error: Conflict Error

Conflict error. Try your request again, as it will most likely succeed.

The regiond.log only has
2018-09-28 12:38:35 regiond: [info] ::1 POST /MAAS/api/2.0/machines/thsxqs/?op=deploy HTTP/1.1 --> 409 CONFLICT (referrer: -; agent: Go-http-client/1.1)

What versions of MAAS and Juju are you working with?

The obvious way this might happen if you have two API clients both requesting the same machine at the same time.

What constraints are being requested? If you try the deployment request manually, does it work? (I would log in using the CLI and try doing something like maas $PROFILE machines allocate $SYSTEM_ID <constraints>, and then maas $PROFILE machine deploy $SYSTEM_ID and check if that succeeds.)

The fact that it gets to the deploy operation is also interesting. That likely means that the machine has already been allocated, just couldn’t be deployed for whatever reason. So that leads to another thought: because the conflict is happening at deploy time, that might mean that MAAS can’t find any free IP addresses to assign the node. (MAAS relies on database transactions to ensure that IP allocations are unique, but returning a CONFLICT is unusual because MAAS should retry the allocation several times until it succeeds.) Can you check the interface configuration of the acquired node, and check if all its networks configured with automatically-assigned IP addresses are attached to subnets that have sufficient free IP addresses?

regiond log from IRC communication in 1. It would seem like MAAS should say why the conflict is but doesn’t.

Yes, it would be nice to have more logging here. Looking at the code, a CONFLICT can explicitly happen on deployment if:

  • The machine is not in READY or ALLOCATED state
  • The machine is owned by another user

I thought I remembered that MAAS returns CONFLICT if an an IP address cannot be allocated (see StaticIPAddressConflict, StaticIPAddressTypeClash, and StaticIPAlreadyExistsForMACAddress), and generally in case of too many transaction retries, but I don’t see evidence of those exception being used any more. That might be a concept left over from MAAS 1.x, because the TooManyRetries exception just seems like a normal exception; I would expect it to cause a 500 Internal Server Error.

It seems that with latest MaaS (2.4.2) the problem has gone (previous ver. 2.3). I will revert back if it comes up again. Thank you!

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