crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 275 forks source link

TypeError: 'NoneType' object does not support item assignment #1851

Closed SilverDash closed 3 years ago

SilverDash commented 3 years ago
(serpent) E:\AI_project\Serpent_AI_Issac>crossbar start --config crossbar.json
2021-01-26T20:24:17-0500 [Controller  12428]
2021-01-26T20:24:17-0500 [Controller  12428]     :::::::::::::::::
2021-01-26T20:24:17-0500 [Controller  12428]           :::::          _____                      __
2021-01-26T20:24:17-0500 [Controller  12428]     :::::   :   :::::   / ___/____ ___   ___  ___  / /  ___ _ ____
2021-01-26T20:24:17-0500 [Controller  12428]     :::::::   :::::::  / /__ / __// _ \ (_-< (_-< / _ \/ _ `// __/
2021-01-26T20:24:17-0500 [Controller  12428]     :::::   :   :::::  \___//_/   \___//___//___//_.__/\_,_//_/
2021-01-26T20:24:17-0500 [Controller  12428]           :::::
2021-01-26T20:24:17-0500 [Controller  12428]     :::::::::::::::::   Crossbar v18.6.1
2021-01-26T20:24:17-0500 [Controller  12428]
2021-01-26T20:24:17-0500 [Controller  12428]     Copyright (c) 2013-2021 Crossbar.io Technologies GmbH, licensed under AGPL 3.0.
2021-01-26T20:24:17-0500 [Controller  12428]
2021-01-26T20:24:17-0500 [Controller  12428] Initializing <class 'crossbar.personality.Personality'> node from node directory "E:\AI_project\Serpent_AI_Issac"
2021-01-26T20:24:17-0500 [Controller  12428] File permissions on node public key fixed
2021-01-26T20:24:17-0500 [Controller  12428] File permissions on node private key fixed
2021-01-26T20:24:17-0500 [Controller  12428] Node key loaded from "E:\AI_project\Serpent_AI_Issac\key.priv"
2021-01-26T20:24:17-0500 [Controller  12428] Node configuration loaded from "E:\AI_project\Serpent_AI_Issac\crossbar.json"
2021-01-26T20:24:17-0500 [Controller  12428] Entering event reactor ...
2021-01-26T20:24:17-0500 [Controller  12428] Starting standalone node
2021-01-26T20:24:17-0500 [Controller  12428] Node ID "silver" set from hostname
2021-01-26T20:24:17-0500 [Controller  12428] No extra node router roles
2021-01-26T20:24:17-0500 [Controller  12428] RouterServiceAgent ready (realm_name="crossbar", on_ready=None)
2021-01-26T20:24:17-0500 [Controller  12428] Registered 21 procedures
2021-01-26T20:24:17-0500 [Controller  12428] Signal handler installed on process 12428 thread 8340
2021-01-26T20:24:17-0500 [Controller  12428] Using default node shutdown triggers ['shutdown_on_worker_exit']
2021-01-26T20:24:17-0500 [Controller  12428] Booting node
2021-01-26T20:24:17-0500 [Controller  12428] Configuring node from local configuration
2021-01-26T20:24:17-0500 [Controller  12428] Starting 1 workers ...
2021-01-26T20:24:17-0500 [Controller  12428] Starting router worker "worker-001"
2021-01-26T20:24:17-0500 [Controller  12428] Starting new managed worker process for Router worker "worker-001"
2021-01-26T20:24:19-0500 [Router      12836] Starting worker "worker-001" for node "silver" with personality "standalone"
2021-01-26T20:24:19-0500 [Router      12836] Running as PID 12836 on CPython-IOCPReactor
2021-01-26T20:24:19-0500 [Router      12836] Entering event reactor ...
2021-01-26T20:24:20-0500 [Controller  12428] Traceback (most recent call last):
  File "e:\users\silver\anaconda3\envs\serpent\lib\site-packages\autobahn\wamp\websocket.py", line 60, in onOpen
    self._session.onOpen(self)
  File "e:\users\silver\anaconda3\envs\serpent\lib\site-packages\crossbar\router\session.py", line 338, in onOpen
    self._transport._transport_info[u'channel_id'] = binascii.b2a_hex(channel_id).decode('ascii')
TypeError: 'NoneType' object does not support item assignment

2021-01-26T20:24:20-0500 [Controller  12428] failing WebSocket connection (code=1011): "WAMP Internal Error ('NoneType' object does not support item assignment)"
2021-01-26T20:24:20-0500 [Router      12836] Connection to node controller closed cleanly
2021-01-26T20:24:20-0500 [Controller  12428] Native worker connection closed cleanly.
2021-01-26T20:24:20-0500 [Controller  12428] Node worker worker-001 ended successfully
2021-01-26T20:24:20-0500 [Controller  12428] Checking for node shutdown: worker_exit_success=True, shutdown_requested=False, node_shutdown_triggers=['shutdown_on_worker_exit']
2021-01-26T20:24:20-0500 [Controller  12428] Node worker ended, and trigger 'shutdown_on_worker_exit' is active: will shutdown node ..
2021-01-26T20:24:20-0500 [Controller  12428] Node shutdown requested (restart=False, mode=None, reactor.running=True) ..

Ran into an issue with crossbar refusing to start. Not sure if this is my end or your end.

Running python 3.6 via conda

Yes I'm trying to work with serpent AI :) Need to learn it a bit.

SilverDash commented 3 years ago
    "version": 2,
    "controller": {},
    "workers": [{
        "type": "router",
        "options": {},
        "realms": [
            {
                "name": "serpent",
                "roles": [{
                        "name": "backend",
                        "permissions": [{
                            "uri": "*",
                            "allow": {
                                "call": true,
                                "register": true,
                                "publish": true,
                                "subscribe": true
                            },
                            "disclose": {
                                "caller": true,
                                "publisher": true
                            }
                        }]
                    },
                    {
                        "name": "client",
                        "permissions": [{
                            "uri": "*",
                            "allow": {
                                "call": true,
                                "register": false,
                                "publish": false,
                                "subscribe": true
                            },
                            "disclose": {
                                "caller": true,
                                "publisher": true
                            },
                            "cache": true
                        }]
                    }
                ]
            }
        ],
        "transports": [{
            "type": "websocket",
            "endpoint": {
                "interface": "localhost",
                "type": "tcp",
                "port": 9999
            },
            "auth": {
                "wampcra": {
                    "type": "static",
                    "users": {
                        "serpent": {
                            "secret": "serpent",
                            "role": "backend"
                        },
                        "dashboard": {
                            "secret": "serpent",
                            "role": "client"
                        }
                    }
                }
            }
        }]
    }]
}

Here is the config

oberstet commented 3 years ago

CPython-IOCPReactor

so you're on windows, right? pls add full version output via: crossbar version

v18.6.1

The current release version of Crossbar.io is https://pypi.org/project/crossbar/20.12.3/

Could you pls try v20.12.3 (on CPython on Windows)?

SilverDash commented 3 years ago
Crossbar.io        : 18.6.1
   Autobahn         : 20.12.3
   Twisted          : 20.3.0-IOCPReactor
   LMDB             : 1.0.0/lmdb-0.9.24
   Python           : 3.6.12/CPython
 Frozen executable  : no
 Operating system   : Windows-10-10.0.18362-SP0
 Host machine       : AMD64
 Release key        : RWS0sX8obJP12KpJWWHyPSsJPeAxUVm+JjPWsPKCgxap8uTHuWeWU7ez

I'll do a quick version upgrade test. But I'm not sure if Serpent requires lower version or not.

SilverDash commented 3 years ago

Version upgrade fixed the initial error. Looks like a version mistake on Serpent dev for now. If I find the issue crops up again I'll reopen.

oberstet commented 3 years ago

https://github.com/SerpentAI/SerpentAI/blob/00a487dd088c6ca2528d025f3273c0a796efe210/pyproject.toml#L114

oberstet commented 3 years ago

I'm not sure why Serpent directly depends on Crossbar.io, and why it does pin the version in doing so, and also not sure about this stuff:

oberstet@intel-nuci7:~/scm/3rdparty/SerpentAI$ find . -type f -exec grep -Hi "crossbar" {} \;
...
./serpent/game.py:        self.crossbar_process = None
./serpent/game.py:        self.start_crossbar()
./serpent/game.py:            self.stop_crossbar()
./serpent/game.py:    def start_crossbar(self):
./serpent/game.py:        if self.crossbar_process is not None:
./serpent/game.py:            self.stop_crossbar()
./serpent/game.py:        crossbar_command = f"crossbar start --config crossbar.json"
./serpent/game.py:        self.crossbar_process = subprocess.Popen(shlex.split(crossbar_command))
./serpent/game.py:        signal.signal(signal.SIGINT, self._handle_signal_crossbar)
./serpent/game.py:        signal.signal(signal.SIGTERM, self._handle_signal_crossbar)
./serpent/game.py:        atexit.register(self._handle_signal_crossbar, 15, None, False)
./serpent/game.py:    def stop_crossbar(self):
./serpent/game.py:        if self.crossbar_process is None:
./serpent/game.py:        self.crossbar_process.kill()
./serpent/game.py:        self.crossbar_process = None
./serpent/game.py:        atexit.unregister(self._handle_signal_crossbar)
./serpent/game.py:    def _handle_signal_crossbar(self, signum=15, frame=None, do_exit=True):
./serpent/game.py:        if self.crossbar_process is not None:
./serpent/game.py:            if self.crossbar_process.poll() is None:
./serpent/game.py:                self.crossbar_process.send_signal(signum)
./serpent/serpent.py:from serpent.utilities import clear_terminal, display_serpent_logo, is_linux, is_windows, wait_for_crossbar
./serpent/serpent.py:    # Install Crossbar
./serpent/serpent.py:    subprocess.call(shlex.split("pip install crossbar==18.6.1"))
./serpent/serpent.py:    # Copy the Crossbar config
./serpent/serpent.py:        os.path.join(os.path.dirname(__file__), "crossbar.json"),
./serpent/serpent.py:        os.path.join(os.getcwd(), "crossbar.json")
./serpent/serpent.py:    wait_for_crossbar()
...

FWIW, the actual solution might be cleaning this up - have Crossbar.io be a project dependency like a server package (eg Nginx), but not a direct package dependency. Then, only rely on Crossbar.io CLI for starting from Serpent (if that is what was desired in the first place).

SilverDash commented 3 years ago

Yeah I'm not sure why it's installing a specific version. I took a look at that and assumed the dev had a reason.