IP reservation TransactionManagementError

Bug #1409852 reported by Adam Collard
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Undecided
Unassigned
1.7
Fix Released
Critical
Unassigned

Bug Description

When reserving IP addresses in MAAS over the API, requests are rejected as 500 Internal Server Error and the following traceback appears (multiple times) in maas-django.log

ERROR 2015-01-12 11:32:01,043 twisted {}
ERROR 2015-01-12 11:47:38,344 maasserver ################################ Exception: This is forbidden when an 'atomic' block is active. ################################
ERROR 2015-01-12 11:47:38,360 maasserver ################################ Exception: This is forbidden when an 'atomic' block is active. ################################
ERROR 2015-01-12 11:47:38,410 maasserver Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 167, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 165, in __call__
    result = meth(request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/support.py", line 189, in dispatch
    return function(self, request, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/ip_addresses.py", line 162, in reserve
    request.user, interface, requested_address, mac_address)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 339, in inner
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/maasserver/api/ip_addresses.py", line 79, in claim_ip
    transaction.commit()
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 139, in commit
    get_connection(using).commit()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 167, in commit
    self.validate_no_atomic_block()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 360, in validate_no_atomic_block
    "This is forbidden when an 'atomic' block is active.")
TransactionManagementError: This is forbidden when an 'atomic' block is active.

This is Landscape doing the talking over the API, it is requesting several (~9) IPs at around the same time, seemingly all requests failed in the same way.

maas 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-cli 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-cluster-controller 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-common 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-dhcp 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-dns 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-proxy 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-region-controller 1.7.1~rc2+bzr3334-0ubuntu1~trusty1
maas-region-controller-min 1.7.1~rc2+bzr3334-0ubuntu1~trusty1

Related branches

tags: added: cloud-installer landscape
Revision history for this message
Adam Collard (adam-collard) wrote :

Even when changing the Landscape code to only request 1 IP at a time, this still fails in the same way.

Revision history for this message
Adam Collard (adam-collard) wrote :

Further, easier steps to reproduce:

Given a MAAS CLI profile named courage, with a static IP range in the given CIDR:

$ maas courage ipaddresses reserve network=10.1.0.0/16
This is forbidden when an 'atomic' block is active.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Confirmed on another machine that has rc2 (1.7.1~rc2+bzr3334-0ubuntu1~trusty1):

$ maas admin-atlas ipaddresses reserve network=10.96.0.0/16
This is forbidden when an 'atomic' block is active.

On a machine with 1.7.0+bzr3299-0ubuntu1~trusty the command works:

root@maas:~# maas admin ipaddresses reserve network=10.0.5.0/24
{
    "alloc_type": 4,
    "ip": "10.0.5.110",
    "resource_uri": "/MAAS/api/1.0/ipaddresses/",
    "created": "2015-01-12T20:27:21.065"
}

Changed in maas:
status: New → Confirmed
Raphaël Badin (rvb)
Changed in maas:
importance: Undecided → Critical
status: Confirmed → Triaged
Revision history for this message
Raphaël Badin (rvb) wrote :

Thanks for the detailed bug report!

Looks like a semantic conflict introduced by backporting r3391 (revision 3316 in 1.7): trunk uses transaction.atomic along with commit_within_atomic_block but the same method doesn't use commit_within_atomic_block in 1.7.

no longer affects: maas
Changed in maas:
status: New → Fix Released
Revision history for this message
Andres Rodriguez (andreserl) wrote :

This bug has been reported and fixed on upstream MAAS. However, provided that the bug was listed on the debian changelog, this appears as needing verification for pending SRU [1]. This bug did not affect current MAAS in Ubuntu, hence setting this to verification-done to unblock pending SRU.

[1]:http://people.canonical.com/~ubuntu-archive/pending-sru.html

tags: added: verification-done
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.