# Buggy code
def start(self):
    """
    Starts this node. This will start a node controller and then spawn new worker
    processes as needed.
    """
    if not self._config:
        raise Exception("No node configuration set")

    # get controller config/options
    #
    controller_config = self._config.get("controller", {})
    controller_options = controller_config.get("options", {})

    # set controller process title
    #
    try:
        import setproctitle
    except ImportError:
        self.log.warn(
            "Warning, could not set process title (setproctitle not installed)"
        )
    else:
        setproctitle.setproctitle(
            controller_options.get("title", "crossbar-controller")
        )

    # local node management router
    #
    self._router_factory = RouterFactory(None)
    self._router_session_factory = RouterSessionFactory(self._router_factory)
    rlm_config = {"name": self._realm}
    rlm = RouterRealm(None, rlm_config)
    router = self._router_factory.start_realm(rlm)

    # setup global static roles
    #
    self._add_global_roles()

    # always add a realm service session
    #
    cfg = ComponentConfig(self._realm)
    rlm.session = (self.ROUTER_SERVICE)(cfg, router)
    self._router_session_factory.add(rlm.session, authrole="trusted")
    self.log.debug(
        "Router service session attached [{router_service}]",
        router_service=qual(self.ROUTER_SERVICE),
    )

    # add the node controller singleton component
    #
    self._controller = self.NODE_CONTROLLER(self)

    self._router_session_factory.add(self._controller, authrole="trusted")
    self.log.debug(
        "Node controller attached [{node_controller}]",
        node_controller=qual(self.NODE_CONTROLLER),
    )

    # add extra node controller components
    #
    self._add_extra_controller_components(controller_options)

    # setup Node shutdown triggers
    #
    self._set_shutdown_triggers(controller_options)

    panic = False
    try:
        # startup the node personality ..
        yield self._startup()

        # .. and notify systemd that we are fully up and running
        try:
            import sdnotify

            sdnotify.SystemdNotifier().notify("READY=1")
        except:
            # do nothing on non-systemd platforms
            pass

    except ApplicationError as e:
        panic = True
        self.log.error("{msg}", msg=e.error_message())

    except Exception:
        panic = True
        self.log.failure("Could not startup node: {log_failure.value}")

    if panic:
        try:
            self._reactor.stop()
        except twisted.internet.error.ReactorNotRunning:
            pass


# Traceback (builtins.AssertionError)
2017-09-05T14:52:34+0200 [Controller  15960] Starting 2 workers ...
2017-09-05T14:52:34+0200 [Controller  15960] Router worker "worker-001" starting ..
2017-09-05T14:52:34+0200 [Router      15969] Started Router worker "worker-001" [crossbar.worker.router.RouterWorkerSession / CPython-EPollReactor]
2017-09-05T14:52:34+0200 [Router      15969] Router worker "worker-001" session 3303279962187294 initializing ..
2017-09-05T14:52:34+0200 [Router      15969] Registered 35 procedures
2017-09-05T14:52:34+0200 [Router      15969] Router worker "worker-001" session ready
2017-09-05T14:52:34+0200 [Controller  15960] Router worker "worker-001" process 15969 started
2017-09-05T14:52:34+0200 [Router      15969] RouterServiceSession ready [configured on_ready fired]
2017-09-05T14:52:34+0200 [Router      15969] Realm 'realm1' started
2017-09-05T14:52:34+0200 [Controller  15960] Router 'worker-001': realm 'realm-001' (named 'realm1') started
2017-09-05T14:52:34+0200 [Router      15969] role role-001 on realm realm-001 started
2017-09-05T14:52:34+0200 [Controller  15960] Router 'worker-001': role 'role-001' (named 'authenticator') started on realm 'realm-001'
2017-09-05T14:52:34+0200 [Router      15969] role role-002 on realm realm-001 started
2017-09-05T14:52:34+0200 [Controller  15960] Router 'worker-001': role 'role-002' (named 'public') started on realm 'realm-001'
2017-09-05T14:52:34+0200 [Router      15969] started component: labgrid.remote.authenticator.AuthenticatorSession id=1175882440106437
2017-09-05T14:52:34+0200 [Controller  15960] Router 'worker-001': component 'component-001' started
2017-09-05T14:52:34+0200 [Router      15969] Site starting on 20408
2017-09-05T14:52:34+0200 [Controller  15960] Router 'worker-001': transport 'transport-001' started
2017-09-05T14:52:34+0200 [Controller  15960] Could not startup node: Traceback (most recent call last):
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/twisted/internet/defer.py", line 1442, in gotResult
_inlineCallbacks(r, g, deferred)
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
result = result.throwExceptionIntoGenerator(g)
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/crossbar/controller/node.py", line 597, in start
yield self._startup()
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
result = g.send(result)
File "/home/phoenix/.virtualenvs/labgrid/lib/python3.6/site-packages/crossbar/controller/node.py", line 656, in _configure_node_from_config
assert worker_type in self._native_workers
builtins.AssertionError:

# Fixed code
def start(self):
    """
    Starts this node. This will start a node controller and then spawn new worker
    processes as needed.
    """
    if not self._config:
        raise Exception("No node configuration set")

    # get controller config/options
    #
    controller_config = self._config.get("controller", {})
    controller_options = controller_config.get("options", {})

    # set controller process title
    #
    try:
        import setproctitle
    except ImportError:
        self.log.warn(
            "Warning, could not set process title (setproctitle not installed)"
        )
    else:
        setproctitle.setproctitle(
            controller_options.get("title", "crossbar-controller")
        )

    # local node management router
    #
    self._router_factory = RouterFactory(None)
    self._router_session_factory = RouterSessionFactory(self._router_factory)
    rlm_config = {"name": self._realm}
    rlm = RouterRealm(None, rlm_config)
    router = self._router_factory.start_realm(rlm)

    # setup global static roles
    #
    self._add_global_roles()

    # always add a realm service session
    #
    cfg = ComponentConfig(self._realm)
    rlm.session = (self.ROUTER_SERVICE)(cfg, router)
    self._router_session_factory.add(rlm.session, authrole="trusted")
    self.log.debug(
        "Router service session attached [{router_service}]",
        router_service=qual(self.ROUTER_SERVICE),
    )

    # add the node controller singleton component
    #
    self._controller = self.NODE_CONTROLLER(self)

    self._router_session_factory.add(self._controller, authrole="trusted")
    self.log.debug(
        "Node controller attached [{node_controller}]",
        node_controller=qual(self.NODE_CONTROLLER),
    )

    # add extra node controller components
    #
    self._add_extra_controller_components(controller_options)

    # setup Node shutdown triggers
    #
    self._set_shutdown_triggers(controller_options)

    panic = False
    try:
        # startup the node personality ..
        yield self._startup()

        # .. and notify systemd that we are fully up and running
        try:
            import sdnotify

            sdnotify.SystemdNotifier().notify("READY=1")
        except:
            # do nothing on non-systemd platforms
            pass

    except ApplicationError as e:
        panic = True
        self.log.error("{msg}", msg=e.error_message())

    except Exception:
        panic = True
        self.log.failure()
        self.log.error("fatal: could not startup node")

    if panic:
        try:
            self._reactor.stop()
        except twisted.internet.error.ReactorNotRunning:
            pass