Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rawsocket connection issue with crossbar.io router #18

Closed
sashakh opened this issue Dec 13, 2017 · 3 comments
Closed

rawsocket connection issue with crossbar.io router #18

sashakh opened this issue Dec 13, 2017 · 3 comments

Comments

@sashakh
Copy link

sashakh commented Dec 13, 2017

Hi,
I'm running wampcc against crossbar.io router using raw socket protocol and it fails in such way:

$ ./admin --proto raw 127.0.0.1 8000 -R realm1 -p com.example.oncounter --arglist '["hi"]' -d -d
fd: 10, tcp_tx: len 4, hex 7ff30000
fd: 10, tcp_rx: len 4, hex 7ff30000
session #1 handhake error: failed to negotiate rawsocket message serialiser
session #1 timeout waiting for peer
session #1 closing
error, wamp session could not be established

crossbar.io log says:

2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: connection made
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: opening handshake received - 7ff30000
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: client requests us to send out most 16777216 bytes per message
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: client wants to use serializer '3'
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.session.RouterSession] Client session connected - transport: {u'peer': u'tcp4:127.0.0.1:35038', u'protocol': u'wamp.2.cbor', u'type': 'rawsocket'}
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] ApplicationSession started.
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: opening handshake completed: <autobahn.wamp.serializer.CBORSerializer object at 0x7f3cc1a69690>
2017-12-13T20:13:31+0200 [Router      20896 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketProtocol: connection lost: reason = '[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionLost'>: Connection to the other side was lost in a non-clean fashion.

Tracking down onto the code I see that failure happens on wampcc side:
https://github.com/darrenjs/wampcc/blob/master/libs/wampcc/rawsocket_protocol.cc#L167-L170
, where serializer = 3 (as requested by wampcc and echoed by crossbar.io), but only known values for wampcc are 1 and 2 (json and msgpack), so it fails.
Then I've requested serializer explicitly:

./admin --proto raw --proto msgpack 127.0.0.1 8000 -R realm1 -p com.example.oncounter --arglist '["hi"]' -d -d

and it worked fine.

My question is how things should be negotiated between wampcc and crossbar.io and where the fix is needed?
Thanks!

@darrenjs
Copy link
Owner

Hi,

Thanks for the detailed bug info, and I have managed to re-produce it.

I think the bug is that wampcc should not send the value '3' to the server, in the first instance. Re-reading the specs, that is not a supported value. So a fix would be in rawsocket_protocol::initiate(t_initiate_cb cb), to check that the user has selected a specific serialiser; if they haven't, an exception should be thrown.

However, I think the WAMP specification is a little inconsistent here. If using a websocket, the client can say, during login, that it support both Json & MessagePack serialisations, and the server gets to choose. But this feature is apparently not supported for RawSocket (according to docs).

So, short term fix, is to reject the request in the above function. But possibly I will check with the WAMP protocol maintainers to confirm my understanding.

@sashakh
Copy link
Author

sashakh commented Dec 14, 2017 via email

@darrenjs
Copy link
Owner

Fixed on c09a2b4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants