TypeError: 'Machine' object is not iterable

Bug #1556185 reported by Andres Rodriguez on 2016-03-11
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
MAAS
Critical
Blake Rouse

Bug Description

While enlisting multiple machines at the time I see:

==> /var/log/maas/maas.log <==
Mar 12 00:25:48 trusty-maas9 maas.api: [INFO] undesignative-wally: Enlisted new machine

==> /var/log/maas/regiond.log <==
2016-03-12 00:25:48 [maasserver] ERROR: ################################ Exception: 'Machine' object is not iterable ################################
2016-03-12 00:25:48 [maasserver] ERROR: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 180, in view_atomic_with_post_commit_savepoint
    return view_atomic(*args, **kwargs)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3/dist-packages/maasserver/api/support.py", line 54, in __call__
    response = upcall(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/decorators/vary.py", line 21, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/piston3/resource.py", line 229, in __call__
    else: stream = srl.render(request)
  File "/usr/lib/python3/dist-packages/piston3/emitters.py", line 464, in render
    response = serializers.serialize(format, self.data, indent=True)
  File "/usr/lib/python3/dist-packages/django/core/serializers/__init__.py", line 129, in serialize
    s.serialize(queryset, **options)
  File "/usr/lib/python3/dist-packages/django/core/serializers/base.py", line 52, in serialize
    for obj in queryset:
TypeError: 'Machine' object is not iterable

Related branches

Changed in maas:
milestone: none → 2.0.0
importance: Undecided → Critical
description: updated
Gavin Panella (allenap) on 2016-03-16
Changed in maas:
status: New → Triaged
Changed in maas:
assignee: nobody → Gavin Panella (allenap)
Gavin Panella (allenap) on 2016-03-22
Changed in maas:
status: Triaged → In Progress
Gavin Panella (allenap) wrote :

This cannot currently be reproduced.

Changed in maas:
status: In Progress → Incomplete
assignee: Gavin Panella (allenap) → nobody
Andres Rodriguez (andreserl) wrote :

saw this again. It may be causing some machines to fail enlist

2016-04-02 06:32:57 [-] 127.0.0.1 - - [01/Apr/2016:22:32:56 +0000] "POST /MAAS/api/2.0/machines/ HTTP/1.1" 500 32 "-" "curl/7.47.0"
2016-04-02 06:32:57 [-] /usr/lib/python3/dist-packages/piston3/authentication.py:314: django.utils.deprecation.RemovedInDjango19Warning: `request.REQUEST` is deprecated, use `request.GET` or `request.POST` instead.
2016-04-02 06:32:57 [-] /usr/lib/python3/dist-packages/django/core/handlers/wsgi.py:126: django.utils.deprecation.RemovedInDjango19Warning: `MergeDict` is deprecated, use `dict.update()` instead.
2016-04-02 06:32:57 [maasserver] ERROR: ################################ Exception: 'Machine' object is not iterable ################################
2016-04-02 06:32:57 [maasserver] ERROR: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 180, in view_atomic_with_post_commit_savepoint
    return view_atomic(*args, **kwargs)
  File "/usr/lib/python3.5/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3/dist-packages/maasserver/api/support.py", line 54, in __call__
    response = upcall(request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/django/views/decorators/vary.py", line 21, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/piston3/resource.py", line 229, in __call__
    else: stream = srl.render(request)
  File "/usr/lib/python3/dist-packages/piston3/emitters.py", line 464, in render
    response = serializers.serialize(format, self.data, indent=True)
  File "/usr/lib/python3/dist-packages/django/core/serializers/__init__.py", line 129, in serialize
    s.serialize(queryset, **options)
  File "/usr/lib/python3/dist-packages/django/core/serializers/base.py", line 52, in serialize
    for obj in queryset:
TypeError: 'Machine' object is not iterable

2016-04-02 06:32:57 [-] 127.0.0.1 - - [01/Apr/2016:22:32:57 +0000] "POST /MAAS/api/2.0/machines/ HTTP/1.1" 500 32 "-" "curl/7.47.0"
2016-04-02 06:32:58 [-] Successfully configured DNS.
2016-04-02 06:32:58 [RegionServer,0,192.168.20.104] Successfully configured DHCPv4 on rack controller '4y3h7n'.
2016-04-02 06:32:58 [RegionServer,0,192.168.20.104] Successfully configured DHCPv4 on rack controller '4y3h7n'.
2016-04-02 06:32:58 [-] Successfully configured DNS.

Andres Rodriguez (andreserl) wrote :

[ 90.985708] cloud-init[2719]: % Total % Received % Xferd Average Speed Time Time Time Current
[ 90.986254] cloud-init[2719]: Dload Upload Total Spent Left Speed
[ 91.638121] cloud-init[2719]: ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0^M100 342 0 0 100 342 0 1702 --:--:-- --:--:-- --:--:-- 1701^M100 342 0 0 100 342 0 524 --:--:-- --:--:-- --:--:-- 523
[ 91.638771] cloud-init[2719]: curl: (22) The requested URL returned error: 500 INTERNAL SERVER ERROR
[ 91.673708] cloud-init[2719]: % Total % Received % Xferd Average Speed Time Time Time Current
[ 91.674268] cloud-init[2719]: Dload Upload Total Spent Left Speed
[ 92.111508] cloud-init[2719]: ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0^M100 166 0 0 100 166 0 379 --:--:-- --:--:-- --:--:-- 378
[ 92.112278] cloud-init[2719]: curl: (22) The requested URL returned error: 500 INTERNAL SERVER ERROR
[ 92.145264] cloud-init[2719]: =============================================
[ 92.145899] cloud-init[2719]: failed to enlist system maas server
[ 92.146453] cloud-init[2719]: sleeping 60 seconds then poweroff
[ 92.146868] cloud-init[2719]: login with 'ubuntu:ubuntu' to debug and disable poweroff
[ 92.147289] cloud-init[2719]: =============================================

Andres Rodriguez (andreserl) wrote :

So I finally managed to reproduce this:

1. install alpha4, play with it.
2. upgrade to beta2
3. delete all machines (it was a bit laggy experience)
4. try to recommission

What I did next was:

1. stop maas-rackd
2. stop maas-regiond
3. stop postgresl
4. start postgresql
5. start maas-regiond
6. start maas-rackd
7. try to re-enlist machines, and everything worked as expected.

and the issue went away.

Also, I noticed that after I stopped all of the above, MAAS started working faster.. After (7) I delete all machines, and machines deleted really quickly.

Gavin Panella (allenap) on 2016-04-04
Changed in maas:
assignee: nobody → Gavin Panella (allenap)
status: Incomplete → In Progress
Gavin Panella (allenap) on 2016-04-05
Changed in maas:
status: In Progress → Fix Committed
Gavin Panella (allenap) on 2016-04-08
Changed in maas:
status: Fix Committed → In Progress
Changed in maas:
status: In Progress → Fix Committed
Gavin Panella (allenap) on 2016-04-14
Changed in maas:
assignee: Gavin Panella (allenap) → Blake Rouse (blake-rouse)
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers