swift-init fails with TypeError: reduce() of empty sequence with no initial value

Bug #1707595 reported by Kirill Zaitsev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
High
Unassigned

Bug Description

While running latest devstack I've encountered the following error:

2017-07-31 08:19:47.008 | +lib/swift:start_swift:831 [[ True == \T\r\u\e ]]
2017-07-31 08:19:47.024 | +lib/swift:start_swift:832 swift-init --run-dir=/opt/stack/data/swift/run rest start
2017-07-31 08:19:59.122 | Starting container-updater...(/etc/swift/container-server/1.conf)
2017-07-31 08:19:59.122 | Starting account-auditor...(/etc/swift/account-server/1.conf)
2017-07-31 08:19:59.122 | Starting object-replicator...(/etc/swift/object-server/1.conf)
2017-07-31 08:19:59.122 | Starting container-replicator...(/etc/swift/container-server/1.conf)
2017-07-31 08:19:59.122 | Starting object-auditor...(/etc/swift/object-server/1.conf)
2017-07-31 08:19:59.123 | Unable to locate config for object-expirer
2017-07-31 08:19:59.123 | Starting container-auditor...(/etc/swift/container-server/1.conf)
2017-07-31 08:19:59.123 | Starting account-replicator...(/etc/swift/account-server/1.conf)
2017-07-31 08:19:59.123 | Starting account-reaper...(/etc/swift/account-server/1.conf)
2017-07-31 08:19:59.123 | Starting container-sync...(/etc/swift/container-server/1.conf)
2017-07-31 08:19:59.123 | Starting object-updater...(/etc/swift/object-server/1.conf)
2017-07-31 08:19:59.123 | Unable to locate config for container-reconciler
2017-07-31 08:19:59.123 | Starting object-reconstructor...(/etc/swift/object-server/1.conf)
2017-07-31 08:19:59.123 | Traceback (most recent call last):
2017-07-31 08:19:59.123 | File "/usr/local/bin/swift-object-reconstructor", line 6, in <module>
2017-07-31 08:19:59.123 | exec(compile(open(__file__).read(), __file__, 'exec'))
2017-07-31 08:19:59.123 | File "/opt/stack/swift/bin/swift-object-reconstructor", line 31, in <module>
2017-07-31 08:19:59.124 | run_daemon(ObjectReconstructor, conf_file, **options)
2017-07-31 08:19:59.124 | File "/opt/stack/swift/swift/common/daemon.py", line 301, in run_daemon
2017-07-31 08:19:59.124 | DaemonStrategy(klass(conf), logger).run(once=once, **kwargs)
2017-07-31 08:19:59.124 | File "/opt/stack/swift/swift/obj/reconstructor.py", line 228, in __init__
2017-07-31 08:19:59.124 | self.all_local_devices = self.get_local_devices()
2017-07-31 08:19:59.124 | File "/opt/stack/swift/swift/obj/reconstructor.py", line 1037, in get_local_devices
2017-07-31 08:19:59.124 | for devices in policy2devices.values()))
2017-07-31 08:19:59.124 | TypeError: reduce() of empty sequence with no initial value

Changed in swift:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Alistair Coles (alistair-coles) wrote :

Bug introduced here https://review.openstack.org/478416

Fix proposed here https://review.openstack.org/#/c/489133/1 and here https://review.openstack.org/#/c/489112/

The TypeError will be raised when the object-reconstructor is run and no EC policies are configured. When there are no EC policies, the object-reconstructor has no work to do, so no data is 'at risk'. Nevertheless the TypeError should be fixed.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on swift (master)

Change abandoned by Kirill Zaitsev (<email address hidden>) on branch: master
Review: https://review.openstack.org/489133
Reason: in favor of https://review.openstack.org/#/c/489112/1

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/489112
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=45cc1d02d06f33530cefe742465828f5d0d5cd12
Submitter: Jenkins
Branch: master

commit 45cc1d02d06f33530cefe742465828f5d0d5cd12
Author: Kota Tsuyuzaki <email address hidden>
Date: Mon Jul 31 16:20:11 2017 +0900

    Fix reconstructer to be able to run non ec policy environment

    Since the related change, object-reconstructor gathers the local devices
    for ec policy via get_local_devices method but the method causes TypeError when
    attempting *reduce* for empty set list. the list can be empty when no EC config
    found in swift.conf.

    This patch fixes the get_local_devices to return empty set even when no ec config
    in swift.conf without errors.

    Co-Authored-By: Kirill Zaitsev <email address hidden>
    Change-Id: Ic121fb547966787a43f9eae83c91bb2bf640c4be
    Related-Change: 701a172afac37229b85ea762f20428f6f422d29b
    Closes-Bug: #1707595

Changed in swift:
status: Confirmed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to swift (master)

Reviewed: https://review.openstack.org/489281
Committed: https://git.openstack.org/cgit/openstack/swift/commit/?id=8d05325f03a6ca91cf886c0680455c962243ffb9
Submitter: Jenkins
Branch: master

commit 8d05325f03a6ca91cf886c0680455c962243ffb9
Author: Tim Burke <email address hidden>
Date: Mon Jul 31 17:24:40 2017 +0000

    Test reconstruct() with no EC policies

    We have a test for get_local_devices, but let's make some broader
    assertions as well.

    Related-Bug: #1707595
    Change-Id: Ifa696207ffdb3b39650dfeaa3e7c6cfda94050db

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/swift 2.15.1

This issue was fixed in the openstack/swift 2.15.1 release.

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.