hello C++ again...

#1

Hi,

i’m running this version:
Crossbar.io package versions and platform information:

···

Crossbar.io : 0.10.4

Autobahn>Python : 0.10.4
WebSocket UTF8 Validator : ?
WebSocket XOR Masker : ?
WAMP JSON Codec : stdlib
WAMP MsgPack Codec : msgpack-python-0.4.6
Twisted : 15.2.1-EPollReactor
Python : 2.7.8-CPython

OS : Linux-3.16.7-21-desktop-x86_64-with-SuSE-13.2-x86_64
Machine : x86_64

All things seem to compile ok, but at run time:
the hello.cpp seem to use a rawsocket (true raw socket, no wamp, nor magic byte, nor serializer byte, only size and data)
The server side, in python, implement a wamprawsocket requiring the magic byte and serializer byte.

it seem a layer is missing between hello.cpp and server.

Any idea about how to fix this?

Thanks.

Log running crossbar start:

cfb@nb9:~/hello> crossbar start
2015-07-03 23:10:08-0400 [Controller 2594] Log opened.
2015-07-03 23:10:08-0400 [Controller 2594] ==================== Crossbar.io ====================

2015-07-03 23:10:08-0400 [Controller 2594] Crossbar.io 0.10.4 starting
2015-07-03 23:10:08-0400 [Controller 2594] Running on CPython using EPollReactor reactor
2015-07-03 23:10:08-0400 [Controller 2594] Starting from node directory /home/cfb/hello/.crossbar
2015-07-03 23:10:09-0400 [Controller 2594] Starting from local configuration ‘/home/cfb/hello/.crossbar/config.json’
2015-07-03 23:10:09-0400 [Controller 2594] Warning, could not set process title (setproctitle not installed)
2015-07-03 23:10:09-0400 [Controller 2594] Router created for realm ‘crossbar’
2015-07-03 23:10:09-0400 [Controller 2594] No WAMPlets detected in enviroment.
2015-07-03 23:10:09-0400 [Controller 2594] Starting Router with ID ‘worker1’ …
2015-07-03 23:10:09-0400 [Controller 2594] Entering reactor event loop …
2015-07-03 23:10:09-0400 [Router 2599] Log opened.
2015-07-03 23:10:09-0400 [Router 2599] Warning: could not set worker process title (setproctitle not installed)
2015-07-03 23:10:10-0400 [Router 2599] Running under CPython using EPollReactor reactor
2015-07-03 23:10:10-0400 [Router 2599] Entering event loop …
2015-07-03 23:10:10-0400 [Controller 2594] Router with ID ‘worker1’ and PID 2599 started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: realm ‘realm1’ (named ‘realm1’) started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: role ‘role1’ (named ‘anonymous’) started on realm ‘realm1’
2015-07-03 23:10:10-0400 [Router 2599] Site starting on 8080
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport1’ started
2015-07-03 23:10:10-0400 [Router 2599] RawSocket transport factory created using None serializers, max. message size 131072
2015-07-03 23:10:10-0400 [Router 2599] CrossbarWampRawSocketServerFactory starting on 8090
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport2’ started

2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection made
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: opening handshake received - 00000038 <–(this seem the packet size: 56bytes in hex)
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: invalid magic byte (octet 1) in opening handshake: was 0x00, but expected 0x7f
2015-07-03 23:12:28-0400 [Router 2599] Unhandled Error
2015-07-03 23:12:28-0400 [Router 2599] Traceback (most recent call last):
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 101, in callWithLogger
2015-07-03 23:12:28-0400 [Router 2599] return callWithContext({“system”: lp}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 84, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return context.call({ILogContext: newCtx}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 118, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return self.currentContext().callWithContext(ctx, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 81, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return func(*args,**kw)
2015-07-03 23:12:28-0400 [Router 2599] — —
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py”, line 611, in _doReadOrWrite
2015-07-03 23:12:28-0400 [Router 2599] why = selectable.doRead()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 209, in doRead
2015-07-03 23:12:28-0400 [Router 2599] return self._dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 215, in _dataReceived
2015-07-03 23:12:28-0400 [Router 2599] rval = self.protocol.dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 201, in dataReceived
2015-07-03 23:12:28-0400 [Router 2599] self.abort()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 177, in abort
2015-07-03 23:12:28-0400 [Router 2599] raise TransportLost()
2015-07-03 23:12:28-0400 [Router 2599] autobahn.wamp.exception.TransportLost:
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection lost: reason = ‘[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.TransportLost’>:
2015-07-03 23:12:28-0400 [Router 2599] ]’
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: ApplicationSession.onClose raised (‘NoneType’ object has no attribute ‘onClose’)

Log running hello.cpp:

cfb@nb9:~/hello> ./hello
Running on 105800
Starting ASIO I/O loop …
Connected to server
RX preparing to receive message …
TX message (56 octets) …
TX message sent (60 / 60 octets)
ASIO I/O loop ended

config.json:

{
“controller”: {
},
“workers”: [
{
“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”: “rawsocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8090
},
“debug”: true
}
]
}
]
}

0 Likes

#2

Hi,

i’m running this version:
Crossbar.io package versions and platform information:

Crossbar.io : 0.10.4

Autobahn>Python : 0.10.4
WebSocket UTF8 Validator : ?
WebSocket XOR Masker : ?
WAMP JSON Codec : stdlib
WAMP MsgPack Codec : msgpack-python-0.4.6
Twisted : 15.2.1-EPollReactor
Python : 2.7.8-CPython

OS : Linux-3.16.7-21-desktop-x86_64-with-SuSE-13.2-x86_64
Machine : x86_64

All things seem to compile ok, but at run time:
the hello.cpp seem to use a rawsocket (true raw socket, no wamp, nor magic byte, nor serializer byte, only size and data)
The server side, in python, implement a wamprawsocket requiring the magic byte and serializer byte.

it seem a layer is missing between hello.cpp and server.

Any idea about how to fix this?

I haven’t really used AutobahnCpp, but I can reproduce the problem here.

Briefly looking at the code of AutobahnCpp, I think it looks a little suspicious. The start function writes the initial handshake and then reads the reply asyncronously, but does not return a future. Shouldn’t it return a future, so that a user of the library can be sure that the handshake succeeded before proceeding to join a realm? Perhaps I’m missing something, and I’m not sure this is related to this problem.

But I think you’re right in that the message length of the next message is wrongly reaching the router before the handshake packet.

Any of the AutobahnCpp authors who has an idea?

Elvis

···

On Saturday, July 4, 2015 at 5:36:17 AM UTC+2, Christian Faure wrote:

Thanks.

Log running crossbar start:

cfb@nb9:~/hello> crossbar start
2015-07-03 23:10:08-0400 [Controller 2594] Log opened.
2015-07-03 23:10:08-0400 [Controller 2594] ==================== Crossbar.io ====================

2015-07-03 23:10:08-0400 [Controller 2594] Crossbar.io 0.10.4 starting
2015-07-03 23:10:08-0400 [Controller 2594] Running on CPython using EPollReactor reactor
2015-07-03 23:10:08-0400 [Controller 2594] Starting from node directory /home/cfb/hello/.crossbar
2015-07-03 23:10:09-0400 [Controller 2594] Starting from local configuration ‘/home/cfb/hello/.crossbar/config.json’
2015-07-03 23:10:09-0400 [Controller 2594] Warning, could not set process title (setproctitle not installed)
2015-07-03 23:10:09-0400 [Controller 2594] Router created for realm ‘crossbar’
2015-07-03 23:10:09-0400 [Controller 2594] No WAMPlets detected in enviroment.
2015-07-03 23:10:09-0400 [Controller 2594] Starting Router with ID ‘worker1’ …
2015-07-03 23:10:09-0400 [Controller 2594] Entering reactor event loop …
2015-07-03 23:10:09-0400 [Router 2599] Log opened.
2015-07-03 23:10:09-0400 [Router 2599] Warning: could not set worker process title (setproctitle not installed)
2015-07-03 23:10:10-0400 [Router 2599] Running under CPython using EPollReactor reactor
2015-07-03 23:10:10-0400 [Router 2599] Entering event loop …
2015-07-03 23:10:10-0400 [Controller 2594] Router with ID ‘worker1’ and PID 2599 started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: realm ‘realm1’ (named ‘realm1’) started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: role ‘role1’ (named ‘anonymous’) started on realm ‘realm1’
2015-07-03 23:10:10-0400 [Router 2599] Site starting on 8080
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport1’ started
2015-07-03 23:10:10-0400 [Router 2599] RawSocket transport factory created using None serializers, max. message size 131072
2015-07-03 23:10:10-0400 [Router 2599] CrossbarWampRawSocketServerFactory starting on 8090
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport2’ started

2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection made
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: opening handshake received - 00000038 <–(this seem the packet size: 56bytes in hex)
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: invalid magic byte (octet 1) in opening handshake: was 0x00, but expected 0x7f
2015-07-03 23:12:28-0400 [Router 2599] Unhandled Error
2015-07-03 23:12:28-0400 [Router 2599] Traceback (most recent call last):
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 101, in callWithLogger
2015-07-03 23:12:28-0400 [Router 2599] return callWithContext({“system”: lp}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 84, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return context.call({ILogContext: newCtx}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 118, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return self.currentContext().callWithContext(ctx, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 81, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return func(*args,**kw)
2015-07-03 23:12:28-0400 [Router 2599] — —
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py”, line 611, in _doReadOrWrite
2015-07-03 23:12:28-0400 [Router 2599] why = selectable.doRead()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 209, in doRead
2015-07-03 23:12:28-0400 [Router 2599] return self._dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 215, in _dataReceived
2015-07-03 23:12:28-0400 [Router 2599] rval = self.protocol.dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 201, in dataReceived
2015-07-03 23:12:28-0400 [Router 2599] self.abort()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 177, in abort
2015-07-03 23:12:28-0400 [Router 2599] raise TransportLost()
2015-07-03 23:12:28-0400 [Router 2599] autobahn.wamp.exception.TransportLost:
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection lost: reason = ‘[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.TransportLost’>:
2015-07-03 23:12:28-0400 [Router 2599] ]’
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: ApplicationSession.onClose raised (‘NoneType’ object has no attribute ‘onClose’)

Log running hello.cpp:

cfb@nb9:~/hello> ./hello
Running on 105800
Starting ASIO I/O loop …
Connected to server
RX preparing to receive message …
TX message (56 octets) …
TX message sent (60 / 60 octets)
ASIO I/O loop ended

config.json:

{
“controller”: {
},
“workers”: [
{
“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”: “rawsocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8090
},
“debug”: true
}
]
}
]
}

0 Likes

#3

Hi,

i’m running this version:
Crossbar.io package versions and platform information:

Crossbar.io : 0.10.4

Autobahn>Python : 0.10.4
WebSocket UTF8 Validator : ?
WebSocket XOR Masker : ?
WAMP JSON Codec : stdlib
WAMP MsgPack Codec : msgpack-python-0.4.6
Twisted : 15.2.1-EPollReactor
Python : 2.7.8-CPython

OS : Linux-3.16.7-21-desktop-x86_64-with-SuSE-13.2-x86_64
Machine : x86_64

All things seem to compile ok, but at run time:
the hello.cpp seem to use a rawsocket (true raw socket, no wamp, nor magic byte, nor serializer byte, only size and data)
The server side, in python, implement a wamprawsocket requiring the magic byte and serializer byte.

it seem a layer is missing between hello.cpp and server.

Any idea about how to fix this?

I haven’t really used AutobahnCpp, but I can reproduce the problem here.

Briefly looking at the code of AutobahnCpp, I think it looks a little suspicious. The start function writes the initial handshake and then reads the reply asyncronously, but does not return a future. Shouldn’t it return a future, so that a user of the library can be sure that the handshake succeeded before proceeding to join a realm? Perhaps I’m missing something, and I’m not sure this is related to this problem.

But I think you’re right in that the message length of the next message is wrongly reaching the router before the handshake packet.

Any of the AutobahnCpp authors who has an idea?

Aha. Now I see, the version of AutobahnCpp that crossbar --template hello:cpp ... generates seems old, and does not have

https://github.com/tavendo/AutobahnCpp/commit/b7be19944adef595679c977a11bc4223621c0080

@Christian: If you update the AutobahnCpp in the autobahn/ directory, I think it should work. It will initiate the handshake correctly [1].

Cheers,

Elvis

[1] https://github.com/tavendo/AutobahnCpp/blob/master/autobahn/autobahn_impl.hpp#L60-L75

···

On Sunday, July 5, 2015 at 11:59:36 AM UTC+2, Elvis Stansvik wrote:

On Saturday, July 4, 2015 at 5:36:17 AM UTC+2, Christian Faure wrote:

Elvis

Thanks.

Log running crossbar start:

cfb@nb9:~/hello> crossbar start
2015-07-03 23:10:08-0400 [Controller 2594] Log opened.
2015-07-03 23:10:08-0400 [Controller 2594] ==================== Crossbar.io ====================

2015-07-03 23:10:08-0400 [Controller 2594] Crossbar.io 0.10.4 starting
2015-07-03 23:10:08-0400 [Controller 2594] Running on CPython using EPollReactor reactor
2015-07-03 23:10:08-0400 [Controller 2594] Starting from node directory /home/cfb/hello/.crossbar
2015-07-03 23:10:09-0400 [Controller 2594] Starting from local configuration ‘/home/cfb/hello/.crossbar/config.json’
2015-07-03 23:10:09-0400 [Controller 2594] Warning, could not set process title (setproctitle not installed)
2015-07-03 23:10:09-0400 [Controller 2594] Router created for realm ‘crossbar’
2015-07-03 23:10:09-0400 [Controller 2594] No WAMPlets detected in enviroment.
2015-07-03 23:10:09-0400 [Controller 2594] Starting Router with ID ‘worker1’ …
2015-07-03 23:10:09-0400 [Controller 2594] Entering reactor event loop …
2015-07-03 23:10:09-0400 [Router 2599] Log opened.
2015-07-03 23:10:09-0400 [Router 2599] Warning: could not set worker process title (setproctitle not installed)
2015-07-03 23:10:10-0400 [Router 2599] Running under CPython using EPollReactor reactor
2015-07-03 23:10:10-0400 [Router 2599] Entering event loop …
2015-07-03 23:10:10-0400 [Controller 2594] Router with ID ‘worker1’ and PID 2599 started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: realm ‘realm1’ (named ‘realm1’) started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: role ‘role1’ (named ‘anonymous’) started on realm ‘realm1’
2015-07-03 23:10:10-0400 [Router 2599] Site starting on 8080
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport1’ started
2015-07-03 23:10:10-0400 [Router 2599] RawSocket transport factory created using None serializers, max. message size 131072
2015-07-03 23:10:10-0400 [Router 2599] CrossbarWampRawSocketServerFactory starting on 8090
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport2’ started

2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection made
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: opening handshake received - 00000038 <–(this seem the packet size: 56bytes in hex)
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: invalid magic byte (octet 1) in opening handshake: was 0x00, but expected 0x7f
2015-07-03 23:12:28-0400 [Router 2599] Unhandled Error
2015-07-03 23:12:28-0400 [Router 2599] Traceback (most recent call last):
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 101, in callWithLogger
2015-07-03 23:12:28-0400 [Router 2599] return callWithContext({“system”: lp}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 84, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return context.call({ILogContext: newCtx}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 118, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return self.currentContext().callWithContext(ctx, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 81, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return func(*args,**kw)
2015-07-03 23:12:28-0400 [Router 2599] — —
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py”, line 611, in _doReadOrWrite
2015-07-03 23:12:28-0400 [Router 2599] why = selectable.doRead()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 209, in doRead
2015-07-03 23:12:28-0400 [Router 2599] return self._dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 215, in _dataReceived
2015-07-03 23:12:28-0400 [Router 2599] rval = self.protocol.dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 201, in dataReceived
2015-07-03 23:12:28-0400 [Router 2599] self.abort()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 177, in abort
2015-07-03 23:12:28-0400 [Router 2599] raise TransportLost()
2015-07-03 23:12:28-0400 [Router 2599] autobahn.wamp.exception.TransportLost:
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection lost: reason = ‘[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.TransportLost’>:
2015-07-03 23:12:28-0400 [Router 2599] ]’
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: ApplicationSession.onClose raised (‘NoneType’ object has no attribute ‘onClose’)

Log running hello.cpp:

cfb@nb9:~/hello> ./hello
Running on 105800
Starting ASIO I/O loop …
Connected to server
RX preparing to receive message …
TX message (56 octets) …
TX message sent (60 / 60 octets)
ASIO I/O loop ended

config.json:

{
“controller”: {
},
“workers”: [
{
“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”: “rawsocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8090
},
“debug”: true
}
]
}
]
}

0 Likes

#4

Hi,

i’m running this version:
Crossbar.io package versions and platform information:

Crossbar.io : 0.10.4

Autobahn>Python : 0.10.4
WebSocket UTF8 Validator : ?
WebSocket XOR Masker : ?
WAMP JSON Codec : stdlib
WAMP MsgPack Codec : msgpack-python-0.4.6
Twisted : 15.2.1-EPollReactor
Python : 2.7.8-CPython

OS : Linux-3.16.7-21-desktop-x86_64-with-SuSE-13.2-x86_64
Machine : x86_64

All things seem to compile ok, but at run time:
the hello.cpp seem to use a rawsocket (true raw socket, no wamp, nor magic byte, nor serializer byte, only size and data)
The server side, in python, implement a wamprawsocket requiring the magic byte and serializer byte.

it seem a layer is missing between hello.cpp and server.

Any idea about how to fix this?

I haven’t really used AutobahnCpp, but I can reproduce the problem here.

Briefly looking at the code of AutobahnCpp, I think it looks a little suspicious. The start function writes the initial handshake and then reads the reply asyncronously, but does not return a future. Shouldn’t it return a future, so that a user of the library can be sure that the handshake succeeded before proceeding to join a realm? Perhaps I’m missing something, and I’m not sure this is related to this problem.

And regarding this, it wasn’t so bad: Looking closer, AutobahnCpp won’t enter its send/receive cycle until the handshake reply has been received, so I guess a void return value is OK.

Elvis

···

On Sunday, July 5, 2015 at 11:59:36 AM UTC+2, Elvis Stansvik wrote:

On Saturday, July 4, 2015 at 5:36:17 AM UTC+2, Christian Faure wrote:

But I think you’re right in that the message length of the next message is wrongly reaching the router before the handshake packet.

Any of the AutobahnCpp authors who has an idea?

Elvis

Thanks.

Log running crossbar start:

cfb@nb9:~/hello> crossbar start
2015-07-03 23:10:08-0400 [Controller 2594] Log opened.
2015-07-03 23:10:08-0400 [Controller 2594] ==================== Crossbar.io ====================

2015-07-03 23:10:08-0400 [Controller 2594] Crossbar.io 0.10.4 starting
2015-07-03 23:10:08-0400 [Controller 2594] Running on CPython using EPollReactor reactor
2015-07-03 23:10:08-0400 [Controller 2594] Starting from node directory /home/cfb/hello/.crossbar
2015-07-03 23:10:09-0400 [Controller 2594] Starting from local configuration ‘/home/cfb/hello/.crossbar/config.json’
2015-07-03 23:10:09-0400 [Controller 2594] Warning, could not set process title (setproctitle not installed)
2015-07-03 23:10:09-0400 [Controller 2594] Router created for realm ‘crossbar’
2015-07-03 23:10:09-0400 [Controller 2594] No WAMPlets detected in enviroment.
2015-07-03 23:10:09-0400 [Controller 2594] Starting Router with ID ‘worker1’ …
2015-07-03 23:10:09-0400 [Controller 2594] Entering reactor event loop …
2015-07-03 23:10:09-0400 [Router 2599] Log opened.
2015-07-03 23:10:09-0400 [Router 2599] Warning: could not set worker process title (setproctitle not installed)
2015-07-03 23:10:10-0400 [Router 2599] Running under CPython using EPollReactor reactor
2015-07-03 23:10:10-0400 [Router 2599] Entering event loop …
2015-07-03 23:10:10-0400 [Controller 2594] Router with ID ‘worker1’ and PID 2599 started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: realm ‘realm1’ (named ‘realm1’) started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: role ‘role1’ (named ‘anonymous’) started on realm ‘realm1’
2015-07-03 23:10:10-0400 [Router 2599] Site starting on 8080
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport1’ started
2015-07-03 23:10:10-0400 [Router 2599] RawSocket transport factory created using None serializers, max. message size 131072
2015-07-03 23:10:10-0400 [Router 2599] CrossbarWampRawSocketServerFactory starting on 8090
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport2’ started

2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection made
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: opening handshake received - 00000038 <–(this seem the packet size: 56bytes in hex)
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: invalid magic byte (octet 1) in opening handshake: was 0x00, but expected 0x7f
2015-07-03 23:12:28-0400 [Router 2599] Unhandled Error
2015-07-03 23:12:28-0400 [Router 2599] Traceback (most recent call last):
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 101, in callWithLogger
2015-07-03 23:12:28-0400 [Router 2599] return callWithContext({“system”: lp}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 84, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return context.call({ILogContext: newCtx}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 118, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return self.currentContext().callWithContext(ctx, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 81, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return func(*args,**kw)
2015-07-03 23:12:28-0400 [Router 2599] — —
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py”, line 611, in _doReadOrWrite
2015-07-03 23:12:28-0400 [Router 2599] why = selectable.doRead()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 209, in doRead
2015-07-03 23:12:28-0400 [Router 2599] return self._dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 215, in _dataReceived
2015-07-03 23:12:28-0400 [Router 2599] rval = self.protocol.dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 201, in dataReceived
2015-07-03 23:12:28-0400 [Router 2599] self.abort()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 177, in abort
2015-07-03 23:12:28-0400 [Router 2599] raise TransportLost()
2015-07-03 23:12:28-0400 [Router 2599] autobahn.wamp.exception.TransportLost:
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection lost: reason = ‘[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.TransportLost’>:
2015-07-03 23:12:28-0400 [Router 2599] ]’
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: ApplicationSession.onClose raised (‘NoneType’ object has no attribute ‘onClose’)

Log running hello.cpp:

cfb@nb9:~/hello> ./hello
Running on 105800
Starting ASIO I/O loop …
Connected to server
RX preparing to receive message …
TX message (56 octets) …
TX message sent (60 / 60 octets)
ASIO I/O loop ended

config.json:

{
“controller”: {
},
“workers”: [
{
“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”: “rawsocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8090
},
“debug”: true
}
]
}
]
}

0 Likes

#5

Thanks!
very apreciated help!
You are right, is only an outdated template, upgrading autobahn folder of hello.cpp from the link, it work perfectly!
Best regards
Christian

···

On Sunday, July 5, 2015 at 6:32:40 AM UTC-4, Elvis Stansvik wrote:

On Sunday, July 5, 2015 at 11:59:36 AM UTC+2, Elvis Stansvik wrote:

On Saturday, July 4, 2015 at 5:36:17 AM UTC+2, Christian Faure wrote:

Hi,

i’m running this version:
Crossbar.io package versions and platform information:

Crossbar.io : 0.10.4

Autobahn>Python : 0.10.4
WebSocket UTF8 Validator : ?
WebSocket XOR Masker : ?
WAMP JSON Codec : stdlib
WAMP MsgPack Codec : msgpack-python-0.4.6
Twisted : 15.2.1-EPollReactor
Python : 2.7.8-CPython

OS : Linux-3.16.7-21-desktop-x86_64-with-SuSE-13.2-x86_64
Machine : x86_64

All things seem to compile ok, but at run time:
the hello.cpp seem to use a rawsocket (true raw socket, no wamp, nor magic byte, nor serializer byte, only size and data)
The server side, in python, implement a wamprawsocket requiring the magic byte and serializer byte.

it seem a layer is missing between hello.cpp and server.

Any idea about how to fix this?

I haven’t really used AutobahnCpp, but I can reproduce the problem here.

Briefly looking at the code of AutobahnCpp, I think it looks a little suspicious. The start function writes the initial handshake and then reads the reply asyncronously, but does not return a future. Shouldn’t it return a future, so that a user of the library can be sure that the handshake succeeded before proceeding to join a realm? Perhaps I’m missing something, and I’m not sure this is related to this problem.

But I think you’re right in that the message length of the next message is wrongly reaching the router before the handshake packet.

Any of the AutobahnCpp authors who has an idea?

Aha. Now I see, the version of AutobahnCpp that crossbar --template hello:cpp ... generates seems old, and does not have

https://github.com/tavendo/AutobahnCpp/commit/b7be19944adef595679c977a11bc4223621c0080

@Christian: If you update the AutobahnCpp in the autobahn/ directory, I think it should work. It will initiate the handshake correctly [1].

Cheers,

Elvis

[1] https://github.com/tavendo/AutobahnCpp/blob/master/autobahn/autobahn_impl.hpp#L60-L75

Elvis

Thanks.

Log running crossbar start:

cfb@nb9:~/hello> crossbar start
2015-07-03 23:10:08-0400 [Controller 2594] Log opened.
2015-07-03 23:10:08-0400 [Controller 2594] ==================== Crossbar.io ====================

2015-07-03 23:10:08-0400 [Controller 2594] Crossbar.io 0.10.4 starting
2015-07-03 23:10:08-0400 [Controller 2594] Running on CPython using EPollReactor reactor
2015-07-03 23:10:08-0400 [Controller 2594] Starting from node directory /home/cfb/hello/.crossbar
2015-07-03 23:10:09-0400 [Controller 2594] Starting from local configuration ‘/home/cfb/hello/.crossbar/config.json’
2015-07-03 23:10:09-0400 [Controller 2594] Warning, could not set process title (setproctitle not installed)
2015-07-03 23:10:09-0400 [Controller 2594] Router created for realm ‘crossbar’
2015-07-03 23:10:09-0400 [Controller 2594] No WAMPlets detected in enviroment.
2015-07-03 23:10:09-0400 [Controller 2594] Starting Router with ID ‘worker1’ …
2015-07-03 23:10:09-0400 [Controller 2594] Entering reactor event loop …
2015-07-03 23:10:09-0400 [Router 2599] Log opened.
2015-07-03 23:10:09-0400 [Router 2599] Warning: could not set worker process title (setproctitle not installed)
2015-07-03 23:10:10-0400 [Router 2599] Running under CPython using EPollReactor reactor
2015-07-03 23:10:10-0400 [Router 2599] Entering event loop …
2015-07-03 23:10:10-0400 [Controller 2594] Router with ID ‘worker1’ and PID 2599 started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: realm ‘realm1’ (named ‘realm1’) started
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: role ‘role1’ (named ‘anonymous’) started on realm ‘realm1’
2015-07-03 23:10:10-0400 [Router 2599] Site starting on 8080
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport1’ started
2015-07-03 23:10:10-0400 [Router 2599] RawSocket transport factory created using None serializers, max. message size 131072
2015-07-03 23:10:10-0400 [Router 2599] CrossbarWampRawSocketServerFactory starting on 8090
2015-07-03 23:10:10-0400 [Controller 2594] Router ‘worker1’: transport ‘transport2’ started

2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection made
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: opening handshake received - 00000038 <–(this seem the packet size: 56bytes in hex)
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: invalid magic byte (octet 1) in opening handshake: was 0x00, but expected 0x7f
2015-07-03 23:12:28-0400 [Router 2599] Unhandled Error
2015-07-03 23:12:28-0400 [Router 2599] Traceback (most recent call last):
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 101, in callWithLogger
2015-07-03 23:12:28-0400 [Router 2599] return callWithContext({“system”: lp}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/log.py”, line 84, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return context.call({ILogContext: newCtx}, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 118, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return self.currentContext().callWithContext(ctx, func, *args, **kw)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/python/context.py”, line 81, in callWithContext
2015-07-03 23:12:28-0400 [Router 2599] return func(*args,**kw)
2015-07-03 23:12:28-0400 [Router 2599] — —
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/posixbase.py”, line 611, in _doReadOrWrite
2015-07-03 23:12:28-0400 [Router 2599] why = selectable.doRead()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 209, in doRead
2015-07-03 23:12:28-0400 [Router 2599] return self._dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/twisted/internet/tcp.py”, line 215, in _dataReceived
2015-07-03 23:12:28-0400 [Router 2599] rval = self.protocol.dataReceived(data)
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 201, in dataReceived
2015-07-03 23:12:28-0400 [Router 2599] self.abort()
2015-07-03 23:12:28-0400 [Router 2599] File “/home/cfb/.local/lib/python2.7/site-packages/autobahn/twisted/rawsocket.py”, line 177, in abort
2015-07-03 23:12:28-0400 [Router 2599] raise TransportLost()
2015-07-03 23:12:28-0400 [Router 2599] autobahn.wamp.exception.TransportLost:
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: connection lost: reason = ‘[Failure instance: Traceback (failure with no frames): <class ‘autobahn.wamp.exception.TransportLost’>:
2015-07-03 23:12:28-0400 [Router 2599] ]’
2015-07-03 23:12:28-0400 [Router 2599] WampRawSocketProtocol: ApplicationSession.onClose raised (‘NoneType’ object has no attribute ‘onClose’)

Log running hello.cpp:

cfb@nb9:~/hello> ./hello
Running on 105800
Starting ASIO I/O loop …
Connected to server
RX preparing to receive message …
TX message (56 octets) …
TX message sent (60 / 60 octets)
ASIO I/O loop ended

config.json:

{
“controller”: {
},
“workers”: [
{
“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”: “rawsocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8090
},
“debug”: true
}
]
}
]
}

0 Likes

#6

Hi Christian, Elvis,

I’ve added updating the template in Crossbar.io as an issue - https://github.com/crossbario/crossbar/issues/374

Regards,

Alex

0 Likes

#7

Thanks!

···

2015-07-09 9:37 GMT-04:00 Alexander Gödde alexande...@googlemail.com:

Hi Christian, Elvis,

I’ve added updating the template in Crossbar.io as an issue - https://github.com/crossbario/crossbar/issues/374

Regards,

Alex

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/x_1a69K2MHQ/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/a32aa782-a73d-4c92-a52f-af716ec33972%40googlegroups.com.

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

0 Likes