Skip to content

NonUniqueNameException on identical records from different responders #163

Description

@dtantsur

Per RFC 6762, identical records sent from several sources do not constitute a conflict. However, with python-zeroconf it works only sometimes. I wonder if Python dict ordering may be a problem. My current reproducer:

import logging
import socket
import sys
from time import sleep

from zeroconf import ServiceInfo, Zeroconf

SERVICE = '_openstack._tcp.local.'

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)
    if len(sys.argv) > 1:
        assert sys.argv[1:] == ['--debug']
        logging.getLogger('zeroconf').setLevel(logging.DEBUG)

    info = ServiceInfo(SERVICE,
                       'baremetal.%s' % SERVICE,
                       socket.inet_aton("192.168.42.17"), 80,
                       properties={'path': '/baremetal', 'proto': 'http'})
    info2 = ServiceInfo(SERVICE,
                        'baremetal-introspection.%s' % SERVICE,
                        socket.inet_aton("192.168.42.17"), 5050,
                        properties={'proto': 'http'})

    zeroconf = Zeroconf()
    print("Registration of services, press Ctrl-C to exit...")
    zeroconf.register_service(info)
    zeroconf.register_service(info2)
    try:
        while True:
            sleep(0.1)
    except KeyboardInterrupt:
        pass
    finally:
        print("Unregistering...")
        zeroconf.unregister_service(info)
        zeroconf.close()

Try launching two instances of this script in parallel. If you comment out zeroconf.register_service(info2) things will work again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions