Debugging joining

#1

I’ve tried the -d option and --loglevel trace when starting Crossbar, but neither of them seems to affect the output. How can I get verbose debugging output?

I’m trying to track down a strange problem where a simple test app like

from twisted.internet import reactor

from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):

def onConnect(self):

print(“connected”)

@inlineCallbacks

def onJoin(self, details):

print(“joined”)

self.leave()

if name == ‘main’:

runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm = u"orexplore", debug = True, debug_wamp = True, debug_app = True)

runner.run(Component)

can’t join the realm (only “connected” is printed). I have other components (both Python and JavaScript) that can join the realm just fine. So I’m very puzzled.

My router config YAML is:

···

WAMP router worker.

  • type: router

id: router_worker

realms:

  • name: orexplore

roles:

  • name: anonymous

permissions:

  • uri: ‘*’

publish: true

subscribe: true

call: true

register: true

transports:

  • type: web

endpoint:

type: tcp

port: 8080

paths:

/:

type: static

directory: …/clients/web

ws:

type: websocket

  • type: rawsocket

serializer: msgpack

endpoint:

type: tcp

port: 8090

Grateful for any tips on where this problem might come from.

Cheers,

Elvis

0 Likes

#2

Here's a complete minimal example:

(cb_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

···

2015-03-22 15:16 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

I've tried the -d option and --loglevel trace when starting Crossbar, but
neither of them seems to affect the output. How can I get verbose debugging
output?

I'm trying to track down a strange problem where a simple test app like

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    @inlineCallbacks
    def onJoin(self, details):
        print("joined")
        self.leave()

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm =
u"orexplore", debug = True, debug_wamp = True, debug_app = True)
    runner.run(Component)

can't join the realm (only "connected" is printed). I have other
components (both Python and JavaScript) that can join the realm just fine.
So I'm very puzzled.

My router config YAML is:

#
# WAMP router worker.
#
- type: router
  id: router_worker
  realms:
  - name: orexplore
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: ../clients/web
      ws:
        type: websocket
  - type: rawsocket
    serializer: msgpack
    endpoint:
      type: tcp
      port: 8090

Grateful for any tips on where this problem might come from.

Cheers,
Elvis

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket
(cb_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://localhost:8080/ws", realm =
u"realm1")
    runner.run(Component)
(cb_env)[estan@pyret minimal]$ crossbar start
2015-03-22 15:49:04+0100 [Controller 6239] Log opened.
2015-03-22 15:49:04+0100 [Controller 6239] ====================
Crossbar.io ====================

2015-03-22 15:49:04+0100 [Controller 6239] Crossbar.io 0.10.2 starting
2015-03-22 15:49:04+0100 [Controller 6239] Running on CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Controller 6239] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 15:49:04+0100 [Controller 6239] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 15:49:04+0100 [Controller 6239] Router created for realm
'crossbar'
2015-03-22 15:49:04+0100 [Controller 6239] No WAMPlets detected in
enviroment.
2015-03-22 15:49:04+0100 [Controller 6239] Starting Router with ID
'worker1' ..
2015-03-22 15:49:04+0100 [Controller 6239] Entering reactor event loop ...
2015-03-22 15:49:04+0100 [Router 6242] Log opened.
2015-03-22 15:49:04+0100 [Router 6242] Running under CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Router 6242] Entering event loop ..
2015-03-22 15:49:04+0100 [Controller 6239] Router with ID 'worker1' and
PID 6242 started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': realm
'realm1' started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': role 'role1'
started on realm 'realm1'
2015-03-22 15:49:04+0100 [Router 6242] Site starting on 8080
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': transport
'transport1' started
^Z
[1]+ Stopped crossbar start
(cb_env)[estan@pyret minimal]$ bg
[1]+ crossbar start &
(cb_env)[estan@pyret minimal]$ python test.py
connected

It connects, but will not join :frowning:

Elvis

0 Likes

#3

I've tried the -d option and --loglevel trace when starting Crossbar, but
neither of them seems to affect the output. How can I get verbose debugging
output?

I'm trying to track down a strange problem where a simple test app like

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    @inlineCallbacks
    def onJoin(self, details):
        print("joined")
        self.leave()

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm =
u"orexplore", debug = True, debug_wamp = True, debug_app = True)
    runner.run(Component)

can't join the realm (only "connected" is printed). I have other
components (both Python and JavaScript) that can join the realm just fine.
So I'm very puzzled.

My router config YAML is:

#
# WAMP router worker.
#
- type: router
  id: router_worker
  realms:
  - name: orexplore
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: ../clients/web
      ws:
        type: websocket
  - type: rawsocket
    serializer: msgpack
    endpoint:
      type: tcp
      port: 8090

Grateful for any tips on where this problem might come from.

Cheers,
Elvis

Here's a complete minimal example:

(cb_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket
(cb_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://localhost:8080/ws", realm =
u"realm1")
    runner.run(Component)
(cb_env)[estan@pyret minimal]$ crossbar start
2015-03-22 15:49:04+0100 [Controller 6239] Log opened.
2015-03-22 15:49:04+0100 [Controller 6239] ====================
Crossbar.io ====================

2015-03-22 15:49:04+0100 [Controller 6239] Crossbar.io 0.10.2 starting
2015-03-22 15:49:04+0100 [Controller 6239] Running on CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Controller 6239] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 15:49:04+0100 [Controller 6239] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 15:49:04+0100 [Controller 6239] Router created for realm
'crossbar'
2015-03-22 15:49:04+0100 [Controller 6239] No WAMPlets detected in
enviroment.
2015-03-22 15:49:04+0100 [Controller 6239] Starting Router with ID
'worker1' ..
2015-03-22 15:49:04+0100 [Controller 6239] Entering reactor event loop
...
2015-03-22 15:49:04+0100 [Router 6242] Log opened.
2015-03-22 15:49:04+0100 [Router 6242] Running under CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Router 6242] Entering event loop ..
2015-03-22 15:49:04+0100 [Controller 6239] Router with ID 'worker1' and
PID 6242 started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': realm
'realm1' started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': role
'role1' started on realm 'realm1'
2015-03-22 15:49:04+0100 [Router 6242] Site starting on 8080
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': transport
'transport1' started
^Z
[1]+ Stopped crossbar start
(cb_env)[estan@pyret minimal]$ bg
[1]+ crossbar start &
(cb_env)[estan@pyret minimal]$ python test.py
connected

It connects, but will not join :frowning:

I also tried the above example in a completely new virtualenv. For full
posterity I'm attaching the output from when setting up that env, including
the `pip install crossbar` output, so you can see which versions of stuff
I'm using.

Elvis

log.txt (20.6 KB)

···

2015-03-22 15:51 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:16 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

Elvis

0 Likes

#4

I've also tested to let Crossbar host the component, instead of using
ApplicationRunner:

(minimal_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

···

2015-03-22 16:03 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:51 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:16 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

I've tried the -d option and --loglevel trace when starting Crossbar,
but neither of them seems to affect the output. How can I get verbose
debugging output?

I'm trying to track down a strange problem where a simple test app like

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    @inlineCallbacks
    def onJoin(self, details):
        print("joined")
        self.leave()

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm
= u"orexplore", debug = True, debug_wamp = True, debug_app = True)
    runner.run(Component)

can't join the realm (only "connected" is printed). I have other
components (both Python and JavaScript) that can join the realm just fine.
So I'm very puzzled.

My router config YAML is:

#
# WAMP router worker.
#
- type: router
  id: router_worker
  realms:
  - name: orexplore
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: ../clients/web
      ws:
        type: websocket
  - type: rawsocket
    serializer: msgpack
    endpoint:
      type: tcp
      port: 8090

Grateful for any tips on where this problem might come from.

Cheers,
Elvis

Here's a complete minimal example:

(cb_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket
(cb_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://localhost:8080/ws", realm =
u"realm1")
    runner.run(Component)
(cb_env)[estan@pyret minimal]$ crossbar start
2015-03-22 15:49:04+0100 [Controller 6239] Log opened.
2015-03-22 15:49:04+0100 [Controller 6239] ====================
Crossbar.io ====================

2015-03-22 15:49:04+0100 [Controller 6239] Crossbar.io 0.10.2 starting
2015-03-22 15:49:04+0100 [Controller 6239] Running on CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Controller 6239] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 15:49:04+0100 [Controller 6239] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 15:49:04+0100 [Controller 6239] Router created for realm
'crossbar'
2015-03-22 15:49:04+0100 [Controller 6239] No WAMPlets detected in
enviroment.
2015-03-22 15:49:04+0100 [Controller 6239] Starting Router with ID
'worker1' ..
2015-03-22 15:49:04+0100 [Controller 6239] Entering reactor event loop
...
2015-03-22 15:49:04+0100 [Router 6242] Log opened.
2015-03-22 15:49:04+0100 [Router 6242] Running under CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Router 6242] Entering event loop ..
2015-03-22 15:49:04+0100 [Controller 6239] Router with ID 'worker1' and
PID 6242 started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': realm
'realm1' started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': role
'role1' started on realm 'realm1'
2015-03-22 15:49:04+0100 [Router 6242] Site starting on 8080
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': transport
'transport1' started
^Z
[1]+ Stopped crossbar start
(cb_env)[estan@pyret minimal]$ bg
[1]+ crossbar start &
(cb_env)[estan@pyret minimal]$ python test.py
connected

It connects, but will not join :frowning:

I also tried the above example in a completely new virtualenv. For full
posterity I'm attaching the output from when setting up that env, including
the `pip install crossbar` output, so you can see which versions of stuff
I'm using.

Elvis

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket

- type: container
  options:
    pythonpath:
      - ..
  components:
    - type: class
      classname: test.Component
      realm: orexplore
      transport:
        type: websocket
        endpoint:
          type: tcp
          host: localhost
          port: 8080
        url: ws://localhost:8080/ws
(minimal_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")
(minimal_env)[estan@pyret minimal]$ crossbar start
2015-03-22 16:06:58+0100 [Controller 6569] Log opened.
2015-03-22 16:06:58+0100 [Controller 6569] ====================
Crossbar.io ====================

2015-03-22 16:06:58+0100 [Controller 6569] Crossbar.io 0.10.3 starting
2015-03-22 16:06:58+0100 [Controller 6569] Running on CPython using
EPollReactor reactor
2015-03-22 16:06:58+0100 [Controller 6569] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 16:06:58+0100 [Controller 6569] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 16:06:58+0100 [Controller 6569] Warning, could not set process
title (setproctitle not installed)
2015-03-22 16:06:58+0100 [Controller 6569] Warning: process utilities not
available
2015-03-22 16:06:58+0100 [Controller 6569] Router created for realm
'crossbar'
2015-03-22 16:06:58+0100 [Controller 6569] No WAMPlets detected in
enviroment.
2015-03-22 16:06:58+0100 [Controller 6569] Starting Router with ID
'worker1' ..
2015-03-22 16:06:58+0100 [Controller 6569] Entering reactor event loop ...
2015-03-22 16:06:58+0100 [Router 6572] Log opened.
2015-03-22 16:06:58+0100 [Router 6572] Warning: could not set worker
process title (setproctitle not installed)
2015-03-22 16:06:59+0100 [Router 6572] Running under CPython using
EPollReactor reactor
2015-03-22 16:06:59+0100 [Router 6572] Entering event loop ..
2015-03-22 16:06:59+0100 [Router 6572] Warning: process utilities not
available
2015-03-22 16:06:59+0100 [Controller 6569] Router with ID 'worker1' and
PID 6572 started
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': realm
'realm1' (named 'realm1') started
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': role 'role1'
(named 'anonymous') started on realm 'realm1'
2015-03-22 16:06:59+0100 [Router 6572] Site starting on 8080
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': transport
'transport1' started
2015-03-22 16:06:59+0100 [Controller 6569] Starting Container with ID
'worker2' ..
2015-03-22 16:06:59+0100 [Container 6577] Log opened.
2015-03-22 16:06:59+0100 [Container 6577] Warning: could not set worker
process title (setproctitle not installed)
2015-03-22 16:07:00+0100 [Container 6577] Running under CPython using
EPollReactor reactor
2015-03-22 16:07:00+0100 [Container 6577] Entering event loop ..
2015-03-22 16:07:00+0100 [Container 6577] Warning: process utilities not
available
2015-03-22 16:07:00+0100 [Controller 6569] Container with ID 'worker2'
and PID 6577 started
2015-03-22 16:07:00+0100 [Controller 6569] Container 'worker2':
PYTHONPATH extended
2015-03-22 16:07:00+0100 [Controller 6569] Container 'worker2': component
'component1' started
2015-03-22 16:07:00+0100 [Container 6577] connected

But same problem :frowning:

Elvis

0 Likes

#5

I've tried the -d option and --loglevel trace when starting Crossbar,
but neither of them seems to affect the output. How can I get verbose
debugging output?

I'm trying to track down a strange problem where a simple test app like

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    @inlineCallbacks
    def onJoin(self, details):
        print("joined")
        self.leave()

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm
= u"orexplore", debug = True, debug_wamp = True, debug_app = True)
    runner.run(Component)

can't join the realm (only "connected" is printed). I have other
components (both Python and JavaScript) that can join the realm just fine.
So I'm very puzzled.

My router config YAML is:

#
# WAMP router worker.
#
- type: router
  id: router_worker
  realms:
  - name: orexplore
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: ../clients/web
      ws:
        type: websocket
  - type: rawsocket
    serializer: msgpack
    endpoint:
      type: tcp
      port: 8090

Grateful for any tips on where this problem might come from.

Cheers,
Elvis

Here's a complete minimal example:

(cb_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket
(cb_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://localhost:8080/ws", realm =
u"realm1")
    runner.run(Component)
(cb_env)[estan@pyret minimal]$ crossbar start
2015-03-22 15:49:04+0100 [Controller 6239] Log opened.
2015-03-22 15:49:04+0100 [Controller 6239] ====================
Crossbar.io ====================

2015-03-22 15:49:04+0100 [Controller 6239] Crossbar.io 0.10.2 starting
2015-03-22 15:49:04+0100 [Controller 6239] Running on CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Controller 6239] Starting from node
directory /home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 15:49:04+0100 [Controller 6239] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 15:49:04+0100 [Controller 6239] Router created for realm
'crossbar'
2015-03-22 15:49:04+0100 [Controller 6239] No WAMPlets detected in
enviroment.
2015-03-22 15:49:04+0100 [Controller 6239] Starting Router with ID
'worker1' ..
2015-03-22 15:49:04+0100 [Controller 6239] Entering reactor event loop
...
2015-03-22 15:49:04+0100 [Router 6242] Log opened.
2015-03-22 15:49:04+0100 [Router 6242] Running under CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Router 6242] Entering event loop ..
2015-03-22 15:49:04+0100 [Controller 6239] Router with ID 'worker1'
and PID 6242 started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': realm
'realm1' started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': role
'role1' started on realm 'realm1'
2015-03-22 15:49:04+0100 [Router 6242] Site starting on 8080
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': transport
'transport1' started
^Z
[1]+ Stopped crossbar start
(cb_env)[estan@pyret minimal]$ bg
[1]+ crossbar start &
(cb_env)[estan@pyret minimal]$ python test.py
connected

It connects, but will not join :frowning:

I also tried the above example in a completely new virtualenv. For full
posterity I'm attaching the output from when setting up that env, including
the `pip install crossbar` output, so you can see which versions of stuff
I'm using.

Elvis

I've also tested to let Crossbar host the component, instead of using
ApplicationRunner:

(minimal_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket

- type: container
  options:
    pythonpath:
      - ..
  components:
    - type: class
      classname: test.Component
      realm: orexplore

Err. The above was a paste-o in this last example, and should be realm:
realm1, but the result is the same.

Elvis

···

2015-03-22 16:08 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 16:03 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:51 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:16 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

      transport:
        type: websocket
        endpoint:
          type: tcp
          host: localhost
          port: 8080
        url: ws://localhost:8080/ws
(minimal_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")
(minimal_env)[estan@pyret minimal]$ crossbar start
2015-03-22 16:06:58+0100 [Controller 6569] Log opened.
2015-03-22 16:06:58+0100 [Controller 6569] ====================
Crossbar.io ====================

2015-03-22 16:06:58+0100 [Controller 6569] Crossbar.io 0.10.3 starting
2015-03-22 16:06:58+0100 [Controller 6569] Running on CPython using
EPollReactor reactor
2015-03-22 16:06:58+0100 [Controller 6569] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 16:06:58+0100 [Controller 6569] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 16:06:58+0100 [Controller 6569] Warning, could not set
process title (setproctitle not installed)
2015-03-22 16:06:58+0100 [Controller 6569] Warning: process utilities
not available
2015-03-22 16:06:58+0100 [Controller 6569] Router created for realm
'crossbar'
2015-03-22 16:06:58+0100 [Controller 6569] No WAMPlets detected in
enviroment.
2015-03-22 16:06:58+0100 [Controller 6569] Starting Router with ID
'worker1' ..
2015-03-22 16:06:58+0100 [Controller 6569] Entering reactor event loop
...
2015-03-22 16:06:58+0100 [Router 6572] Log opened.
2015-03-22 16:06:58+0100 [Router 6572] Warning: could not set worker
process title (setproctitle not installed)
2015-03-22 16:06:59+0100 [Router 6572] Running under CPython using
EPollReactor reactor
2015-03-22 16:06:59+0100 [Router 6572] Entering event loop ..
2015-03-22 16:06:59+0100 [Router 6572] Warning: process utilities
not available
2015-03-22 16:06:59+0100 [Controller 6569] Router with ID 'worker1' and
PID 6572 started
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': realm
'realm1' (named 'realm1') started
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': role
'role1' (named 'anonymous') started on realm 'realm1'
2015-03-22 16:06:59+0100 [Router 6572] Site starting on 8080
2015-03-22 16:06:59+0100 [Controller 6569] Router 'worker1': transport
'transport1' started
2015-03-22 16:06:59+0100 [Controller 6569] Starting Container with ID
'worker2' ..
2015-03-22 16:06:59+0100 [Container 6577] Log opened.
2015-03-22 16:06:59+0100 [Container 6577] Warning: could not set worker
process title (setproctitle not installed)
2015-03-22 16:07:00+0100 [Container 6577] Running under CPython using
EPollReactor reactor
2015-03-22 16:07:00+0100 [Container 6577] Entering event loop ..
2015-03-22 16:07:00+0100 [Container 6577] Warning: process utilities
not available
2015-03-22 16:07:00+0100 [Controller 6569] Container with ID 'worker2'
and PID 6577 started
2015-03-22 16:07:00+0100 [Controller 6569] Container 'worker2':
PYTHONPATH extended
2015-03-22 16:07:00+0100 [Controller 6569] Container 'worker2':
component 'component1' started
2015-03-22 16:07:00+0100 [Container 6577] connected

But same problem :frowning:

Elvis

0 Likes

#6

I've tried the -d option and --loglevel trace when starting Crossbar, but
neither of them seems to affect the output. How can I get verbose debugging
output?

I'm trying to track down a strange problem where a simple test app like

from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    @inlineCallbacks
    def onJoin(self, details):
        print("joined")
        self.leave()

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://pyret.local:8080/ws", realm =
u"orexplore", debug = True, debug_wamp = True, debug_app = True)
    runner.run(Component)

can't join the realm (only "connected" is printed). I have other
components (both Python and JavaScript) that can join the realm just fine.
So I'm very puzzled.

I now think I've gotten a little closer to solving it. If I comment out

    def onConnect(self):
        print("connected")

in the test above, the join works ("joined" is printed).

Anyone know why this is so?

Elvis

···

2015-03-22 15:51 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

2015-03-22 15:16 GMT+01:00 Elvis Stansvik <elvs...@gmail.com>:

My router config YAML is:

#
# WAMP router worker.
#
- type: router
  id: router_worker
  realms:
  - name: orexplore
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: ../clients/web
      ws:
        type: websocket
  - type: rawsocket
    serializer: msgpack
    endpoint:
      type: tcp
      port: 8090

Grateful for any tips on where this problem might come from.

Cheers,
Elvis

Here's a complete minimal example:

(cb_env)[estan@pyret minimal]$ cat .crossbar/config.yaml
controller: {}
workers:

#
# WAMP router worker.
#
- type: router
  realms:
  - name: realm1
    roles:
    - name: anonymous
      permissions:
      - uri: '*'
        publish: true
        subscribe: true
        call: true
        register: true
  transports:
  - type: web
    endpoint:
      type: tcp
      port: 8080
    paths:
      /:
        type: static
        directory: web
      ws:
        type: websocket
(cb_env)[estan@pyret minimal]$ cat test.py
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks

from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner

class Component(ApplicationSession):
    def onConnect(self):
        print("connected")

    def onJoin(self, details):
        print("joined")

if __name__ == '__main__':
    runner = ApplicationRunner(url = u"ws://localhost:8080/ws", realm =
u"realm1")
    runner.run(Component)
(cb_env)[estan@pyret minimal]$ crossbar start
2015-03-22 15:49:04+0100 [Controller 6239] Log opened.
2015-03-22 15:49:04+0100 [Controller 6239] ====================
Crossbar.io ====================

2015-03-22 15:49:04+0100 [Controller 6239] Crossbar.io 0.10.2 starting
2015-03-22 15:49:04+0100 [Controller 6239] Running on CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Controller 6239] Starting from node directory
/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar
2015-03-22 15:49:04+0100 [Controller 6239] Starting from local
configuration
'/home/estan/Projekt/orexplore/dev/Elvis/minimal/.crossbar/config.yaml'
2015-03-22 15:49:04+0100 [Controller 6239] Router created for realm
'crossbar'
2015-03-22 15:49:04+0100 [Controller 6239] No WAMPlets detected in
enviroment.
2015-03-22 15:49:04+0100 [Controller 6239] Starting Router with ID
'worker1' ..
2015-03-22 15:49:04+0100 [Controller 6239] Entering reactor event loop
...
2015-03-22 15:49:04+0100 [Router 6242] Log opened.
2015-03-22 15:49:04+0100 [Router 6242] Running under CPython using
EPollReactor reactor
2015-03-22 15:49:04+0100 [Router 6242] Entering event loop ..
2015-03-22 15:49:04+0100 [Controller 6239] Router with ID 'worker1' and
PID 6242 started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': realm
'realm1' started
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': role
'role1' started on realm 'realm1'
2015-03-22 15:49:04+0100 [Router 6242] Site starting on 8080
2015-03-22 15:49:04+0100 [Controller 6239] Router 'worker1': transport
'transport1' started
^Z
[1]+ Stopped crossbar start
(cb_env)[estan@pyret minimal]$ bg
[1]+ crossbar start &
(cb_env)[estan@pyret minimal]$ python test.py
connected

It connects, but will not join :frowning:

Elvis

0 Likes

#7

Hello again Elvis :wink:

Maybe your Overrides Method onJoin needs the same number of arguments (missing the details arg) as the main onJoin method in protocol.py (my working onJoin below, * Note sometimes no print statement is forwarded to router log, more details in my question below on that, and the protocol.py one below that…)?

Question for you: Do you see consistent behavior of the print statement with your code commented out? I’m wondering if this is coincidence with the other issue where print doesn’t always print like we have had dialog on other posts… :slight_smile:

@asyncio.coroutine
def onJoin(self, details):
    try:
        sub = yield from self.subscribe(self)
        print("{} procedures subscribed.".format(len(sub)))
    except Exception as e:
        print(e)

    try:
        res = yield from self.register(self)
        print("{} procedures registered.".format(len(res)))
    except Exception as e:
        print(e)

def onJoin(self, details):
“”"
Implements :func:autobahn.wamp.interfaces.ISession.onJoin
“”"

0 Likes

#8

Hi. It was some time since I sat down with this, but what do you mean with “missing the details arg”, AFAICS I have that arg in the code I sent earlier?

At the moment I’m mostly using logging (Python logging and sometimes Twisted log) instead of printing, but I think I’ve been able to print consistently.

Elvis

···

On Tuesday, April 28, 2015 at 2:49:43 PM UTC+2, Dave Thomas wrote:

Hello again Elvis :wink:

Maybe your Overrides Method onJoin needs the same number of arguments (missing the details arg) as the main onJoin method in protocol.py (my working onJoin below, * Note sometimes no print statement is forwarded to router log, more details in my question below on that, and the protocol.py one below that…)?

Question for you: Do you see consistent behavior of the print statement with your code commented out? I’m wondering if this is coincidence with the other issue where print doesn’t always print like we have had dialog on other posts… :slight_smile:

@asyncio.coroutine
def onJoin(self, details):
    try:
        sub = yield from self.subscribe(self)
        print("{} procedures subscribed.".format(len(sub)))
    except Exception as e:
        print(e)

    try:
        res = yield from self.register(self)
        print("{} procedures registered.".format(len(res)))
    except Exception as e:
        print(e)


def onJoin(self, details):
“”"
Implements :func:autobahn.wamp.interfaces.ISession.onJoin
“”"

0 Likes

#9

My bad Elvis, a case of reading too fast, I transposed onJoin with onConnect and that overrides is listed correctly in your code as having only one arg self… I must be going blind :wink:

For your logging in python (not interested in twisted as my workers are guest Python 3) how are you implementing this? Do you get text forwarded by the router to it’s terminal (same place you run crossbar start)?

0 Likes

#10

Sorry I wasn’t more clear. I meant that I’m currently using twisted.python.log for my native workers, which logs to stdout by default. This seems to work fine and the output ends up in the crossbar start console I use during development. For the single guest worker (I only have one so far), I’m using the logging module from the Python standard library to log to a file. At the moment I’m actually not even running this script as a guest worker, but just as a plain script (my guest isn’t doing any WAMP, it’s a plain pyserial blocking simulator for a serial device).

Elvis

···

On Tuesday, April 28, 2015 at 4:21:31 PM UTC+2, Dave Thomas wrote:

My bad Elvis, a case of reading too fast, I transposed onJoin with onConnect and that overrides is listed correctly in your code as having only one arg self… I must be going blind :wink:

For your logging in python (not interested in twisted as my workers are guest Python 3) how are you implementing this? Do you get text forwarded by the router to it’s terminal (same place you run crossbar start)?

0 Likes

#11

Opened: https://github.com/crossbario/crossbar/issues/314

0 Likes

#12

https://bugs.python.org/issue11633 and https://docs.python.org/2/using/cmdline.html#cmdoption-u are related.

If you set PYTHONUNBUFFERED=1 in your config, logging works as-expected. Perhaps crossbar should just set this env-var automagically? To immediately fix the issue described, add a config snippit like this to your guest:

"options"    : {
"env"        : {
"vars"            : {
"PYTHONUNBUFFERED": "1"
        }
}
}

Crossbar config.json required a string of “1”, it would not accept JSON Int 1

You can also add "-u" to the arguments list (instead of the env-var).

         {
"id": "backend"         ,
"type": "guest"         ,
"executable": "python3"         ,
"arguments": ["backend.py"         ],
"options"            : {
"env"               : {
"vars"                  : {
"PYTHONUNBUFFERED": "1"
               }
},
"workdir": "../backend"            ,
"stdout": "log"            ,
"stderr": "log"            ,
"watch"               : {
"directories": ["../backend"               ],
"action": "restart"
            }
}
}
0 Likes