urgent issue running example code in ticket authentication

84 views
Skip to first unread message

Jun

unread,
Jan 29, 2016, 6:12:54 PM1/29/16
to Crossbar
Hello, 

I saw the issue with  Failed to import class 'authenticator.AuthenticatorSession' when I run the crossbar using the example code. 

Here is what I did: 
1. install the crossbar at my ubuntu machine and verified that it was working fine. 
3. under crossbarexamples/authentication/ticket/dynamic, run /opt/crossbar/bin/crossbar start 

then I saw the following log. I feel it may be some python path issue. Could somebody let me know what is missing in my steps? Thanks. 


log: 
----

2016-01-29T15:05:33-0800 [Router       6349] Worker running under PyPy-EPollReactor

2016-01-29T15:05:34-0800 [Controller   6344] Router with ID 'worker1' and PID 6349 started

2016-01-29T15:05:34-0800 [Controller   6344] Router 'worker1': realm 'realm1' (named 'realm1') started

2016-01-29T15:05:34-0800 [Controller   6344] Router 'worker1': role 'role1' (named 'authenticator') started on realm 'realm1'

2016-01-29T15:05:34-0800 [Controller   6344] Router 'worker1': role 'role2' (named 'backend') started on realm 'realm1'

2016-01-29T15:05:34-0800 [Controller   6344] Router 'worker1': role 'role3' (named 'frontend') started on realm 'realm1'

2016-01-29T15:05:34-0800 [Router       6349] Failed to import class 'authenticator.AuthenticatorSession'

2016-01-29T15:05:34-0800 [Router       6349] Traceback (most recent call last):

2016-01-29T15:05:34-0800 [Router       6349] Failure: exceptions.ImportError: cannot import name 'pprint_json'

2016-01-29T15:05:34-0800 [Controller   6344] Failed to import class 'authenticator.AuthenticatorSession'

2016-01-29T15:05:34-0800 [Controller   6344] Traceback (most recent call last):

2016-01-29T15:05:34-0800 [Controller   6344] Failure: exceptions.ImportError: cannot import name 'pprint_json'

2016-01-29T15:05:34-0800 [Controller   6344] sending TERM to subprocess 6349

2016-01-29T15:05:34-0800 [Controller   6344] waiting for 6349 to exit...

2016-01-29T15:05:34-0800 [Router       6349] Received SIGTERM, shutting down.

2016-01-29T15:05:34-0800 [Router       6349] Connection to node controller lost.

2016-01-29T15:05:34-0800 [Router       6349] No more controller connection; shutting down.

2016-01-29T15:05:34-0800 [Controller   6344] Process connection gone: A process has ended with a probable error condition: process ended with exit code 1.

2016-01-29T15:05:34-0800 [Controller   6344] Node worker worker1 ended (0 workers left)

Gareth Bult

unread,
Jan 29, 2016, 6:41:29 PM1/29/16
to Crossbar
Hi,

What version of crossbar are you using ??
("crossbar version" will tell you)

Jun

unread,
Jan 29, 2016, 6:54:57 PM1/29/16
to Crossbar

Here is the crossbar version info:


Crossbar.io        : 0.11.1

   Autobahn         : 0.10.9

     UTF8 Validator : autobahn

     XOR Masker     : autobahn

     JSON Codec     : stdlib

     MsgPack Codec  : msgpack-python-0.4.6

   Twisted          : 15.4.0-EPollReactor

   Python           : 2.7.10/PyPy-2.6.1

 OS                 : Linux-3.13.0-66-generic-x86_64-with-debian-wheezy-sid

 Machine            : x86_64

Gareth Bult

unread,
Jan 29, 2016, 7:03:43 PM1/29/16
to Crossbar
Ok, pprint_json isn't available in that version so far as I can see (I use the same) .. so I guess the example is designed to use a newer version of crossbar ... (?!)

You could try "pip install crossbar" and see if 0.11.2 works for you ... it does look like that function is in the 11.2 source tree ...

Jun Zou

unread,
Jan 29, 2016, 7:20:48 PM1/29/16
to cross...@googlegroups.com
Actually, my pip install crossbar failed. Any thoughts on the errors? 

  ----------------------------------------

  Failed building wheel for cryptography

...  

  ----------------------------------------

  Failed building wheel for cffi


    ----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-UYpWOw/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-gCxWKA-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-UYpWOw/cffi


--
You received this message because you are subscribed to a topic in the Google Groups "Crossbar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/crossbario/XGdgbol9DNU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to crossbario+...@googlegroups.com.
To post to this group, send email to cross...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/crossbario/f573ec7a-2869-4965-9b2c-d9a5523a6be3%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jun Zou

unread,
Jan 29, 2016, 7:39:27 PM1/29/16
to cross...@googlegroups.com
I installed the 0.11.2 crossbar and still have the same problem but with more detailed error msg as below: 

Can somebody help? 

(python-venv)juzou@my-cpod:~/crossbarexamples/authentication/ticket/dynamic$ crossbar start

2016-01-29T16:32:39-0800 [Controller   9838] Automatically choosing optimal Twisted reactor

2016-01-29T16:32:39-0800 [Controller   9838] Running on Linux and optimal reactor (epoll) was installed.

2016-01-29T16:32:39-0800 [Controller   9838]      __  __  __  __  __  __      __     __

2016-01-29T16:32:39-0800 [Controller   9838]     /  `|__)/  \/__`/__`|__) /\ |__)  |/  \

2016-01-29T16:32:39-0800 [Controller   9838]     \__,|  \\__/.__/.__/|__)/~~\|  \. |\__/

2016-01-29T16:32:39-0800 [Controller   9838]                                         

2016-01-29T16:32:39-0800 [Controller   9838]     Version: 0.11.2     

2016-01-29T16:32:39-0800 [Controller   9838] 

2016-01-29T16:32:39-0800 [Controller   9838] Starting from node directory /home/juzou/crossbarexamples/authentication/ticket/dynamic/.crossbar

2016-01-29T16:32:39-0800 [Controller   9838] Loading node configuration file '/home/juzou/crossbarexamples/authentication/ticket/dynamic/.crossbar/config.json'

2016-01-29T16:32:39-0800 [Controller   9838] Entering reactor event loop...

2016-01-29T16:32:39-0800 [Controller   9838] Warning, could not set process title (setproctitle not installed)

2016-01-29T16:32:39-0800 [Controller   9838] Process utilities not available

2016-01-29T16:32:39-0800 [Controller   9838] Joined realm 'crossbar' on node management router

2016-01-29T16:32:39-0800 [Controller   9838] No WAMPlets detected in enviroment.

2016-01-29T16:32:39-0800 [Controller   9838] Starting Router with ID 'worker1'...

2016-01-29T16:32:39-0800 [Router       9845] Worker running under CPython-EPollReactor

2016-01-29T16:32:39-0800 [Router       9845] Process utilities not available

2016-01-29T16:32:39-0800 [Controller   9838] Router with ID 'worker1' and PID 9845 started

2016-01-29T16:32:39-0800 [Controller   9838] Router 'worker1': realm 'realm1' (named 'realm1') started

2016-01-29T16:32:39-0800 [Controller   9838] Router 'worker1': role 'role1' (named 'authenticator') started on realm 'realm1'

2016-01-29T16:32:39-0800 [Controller   9838] Router 'worker1': role 'role2' (named 'backend') started on realm 'realm1'

2016-01-29T16:32:39-0800 [Controller   9838] Router 'worker1': role 'role3' (named 'frontend') started on realm 'realm1'

2016-01-29T16:32:39-0800 [Router       9845] NativeWorkerSession.onUserError

Traceback (most recent call last):

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/autobahn/twisted/websocket.py", line 163, in _onMessage

    self.onMessage(payload, isBinary)

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/autobahn/wamp/websocket.py", line 95, in onMessage

    self._session.onMessage(msg)

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/autobahn/wamp/protocol.py", line 590, in onMessage

    on_reply = txaio.as_future(endpoint.fn, *invoke_args, **invoke_kwargs)

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/txaio/tx.py", line 339, in as_future

    return maybeDeferred(fun, *args, **kwargs)

--- <exception caught here> ---

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred

    result = f(*args, **kw)

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/crossbar/worker/router.py", line 472, in start_router_component

    create_component = _appsession_loader(config)

  File "/home/juzou/python-venv/local/lib/python2.7/site-packages/crossbar/worker/__init__.py", line 74, in _appsession_loader

    pythonpath=sys.path

autobahn.wamp.exception.ApplicationError: ApplicationError('crossbar.error.class_import_failed', args = ("Failed to import class 'authenticator.AuthenticatorSession'\nTraceback (most recent call last):\nFailure: exceptions.ImportError: cannot import name pprint_json\n",), kwargs = {'pythonpath': [u'/home/juzou/crossbarexamples/authentication/ticket/dynamic', '/home/juzou/python-venv/lib/python2.7/site-packages/crossbar/worker', '/home/juzou/python-venv/bin', '/home/juzou/python-venv/lib/python2.7', '/home/juzou/python-venv/lib/python2.7/plat-linux2', '/home/juzou/python-venv/lib/python2.7/lib-tk', '/home/juzou/python-venv/lib/python2.7/lib-old', '/home/juzou/python-venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/home/juzou/python-venv/local/lib/python2.7/site-packages']})


2016-01-29T16:32:39-0800 [Controller   9838] crossbar.error.class_import_failed: Failed to import class 'authenticator.AuthenticatorSession'

Traceback (most recent call last):

Failure: exceptions.ImportError: cannot import name pprint_json


2016-01-29T16:32:39-0800 [Controller   9838] sending TERM to subprocess 9845

2016-01-29T16:32:39-0800 [Controller   9838] waiting for 9845 to exit...

2016-01-29T16:32:39-0800 [Router       9845] Received SIGTERM, shutting down.

2016-01-29T16:32:39-0800 [Router       9845] Connection to node controller lost.

2016-01-29T16:32:39-0800 [Router       9845] No more controller connection; shutting down.

2016-01-29T16:32:39-0800 [Controller   9838] Process connection gone: A process has ended with a probable error condition: process ended with exit code 1.

2016-01-29T16:32:39-0800 [Controller   9838] Node worker worker1 ended (0 workers left)

2016-01-29T16:32:39-0800 [Controller   9838] Node shutting down ..

2016-01-29T16:32:39-0800 [Controller   9838] Shutting down node...

(python-venv)juzou@my-cpod:~/crossbarexamples/authentication/ticket/dynamic$ pwd

/home/juzou/crossbarexamples/authentication/ticket/dynamic

Gareth Bult

unread,
Jan 29, 2016, 11:58:56 PM1/29/16
to Crossbar
Hi,

I would be inclined to paste in the source for pprint_json directly into the example, I think it's only for pretty output so it's not "key" ...

On Friday, 29 January 2016 23:12:54 UTC, Jun wrote:

Tobias Oberstein

unread,
Jan 30, 2016, 4:39:05 AM1/30/16
to cross...@googlegroups.com
Hi,

I've removed the offending code

https://github.com/crossbario/crossbarexamples/commit/1b08ae92473e9e68a5b22523cea56bbac58574cc

Note: for some examples in "crossbarexamples/authentication/*", you will
need Crossbar.io trunk. Clone from GH and install from that. Or wait for
crossbar 0.12, which will be release the coming days.

Cheers,
/Tobias
> --
> You received this message because you are subscribed to the Google
> Groups "Crossbar" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to crossbario+...@googlegroups.com
> <mailto:crossbario+...@googlegroups.com>.
> To post to this group, send email to cross...@googlegroups.com
> <mailto:cross...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/crossbario/74e96593-c372-4a32-bf8a-dcba2b14e96c%40googlegroups.com
> <https://groups.google.com/d/msgid/crossbario/74e96593-c372-4a32-bf8a-dcba2b14e96c%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages