EliAndrewC / sideboard

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

WebsocketPlugin has no attribute 'pool' #37

Closed robdennis closed 10 years ago

robdennis commented 10 years ago

I'm trying to get the unittests working with tox (#36 ) and I can't get them to pass locally. Is this a problem with my dev environment?

some older versions we were relying on are no longer on pypi, so I bumped them and I'm given it a shot:

 configobj==5.0.2
-cherrypy==3.2.2
+cherrypy==3.2.5
 python-ldap==2.3.13
-ws4py==0.2.2
+ws4py==0.3.2
 SQLAlchemy==0.8.5
 six==1.5.2
 Jinja2==2.6

This may be OBE given that you're upgrading ws4py in another series of tickets, but I'll let you close it if so.

==================================== ERRORS ====================================
______________ ERROR at teardown of JsonrpcTest.test_valid_kwargs ______________

cls = <class 'sideboard.tests.test_jsonrpc.JsonrpcTest'>

    @classmethod
    def tearDownClass(cls):
        cls.close_websocket()
>       cls.stop_cherrypy()

sideboard/tests/__init__.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'sideboard.tests.test_jsonrpc.JsonrpcTest'>

    @classmethod
    def stop_cherrypy(cls):
>       cherrypy.engine.stop()

sideboard/tests/__init__.py:189:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <cherrypy.process.wspbus.Bus object at 0x106e21d10>

    def stop(self):
        """Stop all services."""
        self.state = states.STOPPING
        self.log('Bus STOPPING')
>       self.publish('stop')

env/lib/python2.7/site-packages/cherrypy/process/wspbus.py:403:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <cherrypy.process.wspbus.Bus object at 0x106e21d10>, channel = 'stop'
args = (), kwargs = {}
exc = AttributeError("'WebSocketPlugin' object has no attribute 'pool'",)
output = [None, None, None, None, None, None, ...]
listener = <bound method WebSocketPlugin.stop of <ws4py.server.cherrypyserver.WebSocketPlugin object at 0x106f7d390>>
items = [(25, <bound method Server.stop of <cherrypy._cpserver.Server object at 0x106e42210>>), (50, <bound method Caller.stop...in object at 0x106f7d390>>), (50, <bound method Caller.stop of <sideboard.threads.Caller object at 0x106f7d850>>), ...]
priority = 50

    def publish(self, channel, *args, **kwargs):
        """Return output of all subscribers for the given channel."""
        if channel not in self.listeners:
            return []

        exc = ChannelFailures()
        output = []

        items = [(self._priorities[(channel, listener)], listener)
                 for listener in self.listeners[channel]]
        try:
            items.sort(key=lambda item: item[0])
        except TypeError:
            # Python 2.3 had no 'key' arg, but that doesn't matter
            # since it could sort dissimilar types just fine.
            items.sort()
        for priority, listener in items:
            try:
                output.append(listener(*args, **kwargs))
            except KeyboardInterrupt:
                raise
            except SystemExit:
                e = sys.exc_info()[1]
                # If we have previous errors ensure the exit code is non-zero
                if exc and e.code == 0:
                    e.code = 1
                raise
            except:
                exc.handle_exception()
                if channel == 'log':
                    # Assume any further messages to 'log' will fail.
                    pass
                else:
                    self.log("Error in %r listener %r" % (channel, listener),
                             level=40, traceback=True)
        if exc:
>           raise exc
E           ChannelFailures: AttributeError("'WebSocketPlugin' object has no attribute 'pool'",)

env/lib/python2.7/site-packages/cherrypy/process/wspbus.py:215: ChannelFailures
------------------------------- Captured stderr --------------------------------
2014-03-30 00:13:04,994 [INFO] requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): localhost
2014-03-30 00:13:04,997 [DEBUG] sideboard.server.Root: jsonrpc request body: {u'params': {u'name': u'World'}, u'method': u'testservice.get_message', u'id': u'test_valid_kwargs'}
2014-03-30 00:13:04,997 [DEBUG] sideboard.server.Root: returning success message: {u'jsonrpc': u'2.0', u'id': u'test_valid_kwargs', u'result': u'Hello World!'}
2014-03-30 00:13:05,002 [INFO] cherrypy.access.4412627664: 127.0.0.1 - - [30/Mar/2014:00:13:05] "POST /jsonrpc HTTP/1.1" 200 71 "" "python-requests/1.2.0 CPython/2.7.5 Darwin/13.1.0"
2014-03-30 00:13:05,002 [DEBUG] requests.packages.urllib3.connectionpool: "POST /jsonrpc HTTP/1.1" 200 71
2014-03-30 00:13:05,212 [INFO] cherrypy.error: [30/Mar/2014:00:13:05] ENGINE Bus STOPPING
2014-03-30 00:13:05,224 [INFO] cherrypy.error: [30/Mar/2014:00:13:05] ENGINE HTTP Server cherrypy._cpwsgi_server.CPWSGIServer(('0.0.0.0', 8283)) shut down
2014-03-30 00:13:05,326 [ERROR] cherrypy.error: [30/Mar/2014:00:13:05] ENGINE Error in 'stop' listener <bound method type.close_all of <class 'sideboard.websockets.WebSocketDispatcher'>>
Traceback (most recent call last):
  File "/Users/rad3/development/sideboard/env/lib/python2.7/site-packages/cherrypy/process/wspbus.py", line 197, in publish
    output.append(listener(*args, **kwargs))
  File "/Users/rad3/development/sideboard/sideboard/websockets.py", line 254, in close_all
    for ws in cls.get_all():
  File "/Users/rad3/development/sideboard/sideboard/websockets.py", line 250, in get_all
    return websocket_plugin.pool.keys()[:]
AttributeError: 'WebSocketPlugin' object has no attribute 'pool'

2014-03-30 00:13:05,326 [INFO] cherrypy.error: [30/Mar/2014:00:13:05] ENGINE Stopped thread 'Session cleanup'.
2014-03-30 00:13:05,333 [INFO] ws4py: Closing all websockets with [1001] 'Server is shutting down'
2014-03-30 00:13:05,537 [INFO] cherrypy.error: [30/Mar/2014:00:13:05] ENGINE Stopped thread '_TimeoutMonitor'.
2014-03-30 00:13:05,537 [INFO] cherrypy.error.4431597456: [30/Mar/2014:00:13:05]  Terminating WebSocket processing
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
===================== 13 passed, 1 error in 30.57 seconds ======================
/Users/rad3/development/sideboard/env/lib/python2.7/site-packages/cherrypy/process/wspbus.py:225: RuntimeWarning: The main thread is exiting, but the Bus is in the states.STOPPING state; shutting it down automatically now. You must either call bus.block() after start(), or call bus.exit() before the main thread exits.
  "main thread exits." % self.state, RuntimeWarning)
EliAndrewC commented 10 years ago

The current code relies on a specific of the internals of ws4py that changed, so when you upgraded ws4py it broke.

I'm finishing up the last commit for #8 which also upgrades ws4py and fixes this, so I should have a pull request issued for that tonight. In the meantime you should downgrade ws4py to get it working again.

robdennis commented 10 years ago

closing then. as an FYI relying on versions no longer shown on pypi but still exist seems to put us in a situation where (by default) pip fails to install, but easy_install (by default) will install. Which is an odd place to be.