crossbario / autobahn-cpp

WAMP for C++ in Boost/Asio
https://crossbar.io/autobahn
Boost Software License 1.0
251 stars 104 forks source link

WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection! #226

Closed atimin closed 3 years ago

atimin commented 3 years ago

Hello, everyone :wave:

I'm trying to use C++ to call a WAMP procedure, but faced a problem. I can't join a WAMP session.

This is a debug log on the client side:

RawSocket handshake reply received
connect successful: valid handshake
RX preparing to receive message ..
TX message (122 octets) ...
TX message: hello ["adt", {"authid":"","authmethods":[],"roles":{"subscriber":{},"publisher":{},"callee":{"features":{"call_timeout":true}},"caller":{"features":{"call_timeout":true}}}}]

this is the error message on the router side:

crossbar_1  | 2021-05-31T12:25:51+0000 [Router         21] attached session 5962325433392633 to realm "adt" (authid="UQUM-CVR5-7WL5-GCET-KK9C-LYJH", authrole="anonymous") <crossbar.router.router.Router.attach>
crossbar_1  | 2021-05-31T12:26:58+0000 [Router         21] WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection!

Crossbar.io srotuer configuration:

{
  "version": 2,
  "controller": {},
  "workers": [
    {
      "type": "router",
      "realms": [
        {
          "name": "adt",
          "roles": [
            {
              "name": "anonymous",
              "permissions": [
                {
                  "uri": "",
                  "match": "prefix",
                  "allow": {
                    "call": true,
                    "register": true,
                    "publish": true,
                    "subscribe": true
                  },
                  "disclose": {
                    "caller": false,
                    "publisher": false
                  },
                  "cache": true
                }
              ]
            }
          ]
        }
      ],
      "transports": [
        {
          "type": "web",
          "endpoint": {
            "type": "tcp",
            "port": 8080
          },
          "paths": {
            "/": {
              "type": "static",
              "directory": "../web",
              "options": {
                "enable_directory_listing": true
              }
            },
            "info": {
              "type": "nodeinfo"
            },
            "ws": {
              "type": "websocket"
            }
          }
        },
        {
          "type": "rawsocket",
          "endpoint": {
            "type": "tcp",
            "port": 8081
          }
        }
      ]
    }
  ]
}

I'm using crossbar.io router from the last Docker image and autobahn from master branch.

The full code of my program:

// Copyright 2021 PANDA GmbH

#include <autobahn/autobahn.hpp>
#include <autobahn/wamp_websocketpp_websocket_transport.hpp>
#include <drift/http/uri.h>
#include <drift/utils/env_variable.h>
#include <drift/utils/log.h>

#include <csignal>

#include "core/service.h"

static bool running = true;

void SignalHandler(int signum) { running = false; }

int main() {
  using adt::core::Service;
  using TcpResolver = boost::asio::ip::tcp::resolver;
  using drift::utils::EnvVariableFactory;

  std::signal(SIGINT, SignalHandler);
  std::signal(SIGTERM, SignalHandler);

  auto log_level = EnvVariableFactory::Make<std::string>("LOG_LEVEL", "DEBUG");
  auto wamp_router = EnvVariableFactory::Make<std::string>(
      "WAMP_ROUTER", "rs://127.0.0.1:8081");
  auto wamp_realm = EnvVariableFactory::Make<std::string>("WAMP_REALM", "adt");

  drift::utils::Logger::SetLogLevel(static_cast<std::string>(log_level));
  LOG_INFO() << "Start in the environment: \n" << EnvVariableFactory::Log();

  drift::http::UriParser parser;
  if (!parser.Parse(static_cast<std::string>(wamp_router))) {
    LOG_ERROR() << "Failed parse URL: " << wamp_router;
    return -1;
  }

  boost::asio::io_service io;

  TcpResolver resolver(io);
  TcpResolver::query q(parser.host(), parser.port());
  auto results = resolver.resolve(q);

  auto endpoint = results.begin()->endpoint();

  auto debug = static_cast<std::string>(log_level) == "DEBUG";
  auto transport =
      std::make_shared<autobahn::wamp_tcp_transport>(io, endpoint, debug);

  auto session = std::make_shared<autobahn::wamp_session>(io, debug);
  transport->attach(
      std::static_pointer_cast<autobahn::wamp_transport_handler>(session));

  boost::future<void> connect_future;
  boost::future<void> start_future;
  boost::future<void> join_future;
  boost::future<void> provide_future;
  boost::future<void> leave_future;
  boost::future<void> stop_future;

  connect_future = transport->connect().then([&](auto started) {
    try {
      started.get();
    } catch (const std::exception& e) {
      LOG_ERROR() << e.what();
      io.stop();
      return;
    }

    LOG_INFO() << "Connected with " << wamp_router;

    start_future = session->start().then([&](auto started) {
      try {
        started.get();
      } catch (const std::exception& e) {
        LOG_ERROR() << e.what();
        io.stop();
        return;
      }

      LOG_INFO() << "Start WAMP session";
      join_future =
          session->join(static_cast<std::string>("adt"))
              .then([&](boost::future<uint64_t> joined) {
                try {
                  LOG_INFO() << "joined realm: " << joined.get();
                } catch (const std::exception& e) {
                  LOG_ERROR() << e.what();
                  io.stop();
                  return;
                }

                provide_future =
                    session->call("com.examples.calculator.get")
                        .then([&](boost::future<autobahn::wamp_call_result>
                                      result) {
                          try {
                            auto ret = result.get();
                            LOG_INFO()
                                << ret.argument<int>(0) << ret.argument<bool>(1)
                                << ret.argument<float>(2)
                                << ret.argument<std::string>(3);
                          } catch (const std::exception& e) {
                            LOG_ERROR() << e.what();
                            io.stop();
                            return;
                          }

                          leave_future = session->leave().then(
                              [&](boost::future<std::string> reason) {
                                try {
                                  std::cerr << "left session (" << reason.get()
                                            << ")" << std::endl;
                                } catch (const std::exception& e) {
                                  std::cerr
                                      << "failed to leave session: " << e.what()
                                      << std::endl;
                                  io.stop();
                                  return;
                                }

                                stop_future = session->stop().then(
                                    [&](boost::future<void> stopped) {
                                      std::cerr << "stopped session"
                                                << std::endl;
                                      io.stop();
                                    });
                              });
                        });
              });

      LOG_INFO() << "Join session...";
    });
  });

  io.run();

  Service service({}, {});
  service.Start(running);

  transport->detach();

  LOG_INFO() << "Graceful exit";
  return 0;
}

I also tried the Python and JS clients, they work perfectly. Unfortunately (or fortunately :slightly_smiling_face: ) , we need C++ client and I'd appreciate your help.

oberstet commented 3 years ago

^ ok, not sure .. it looks weird. I've gone through the config and log lines, and it seems the initial rawsocket and wamp opening handshakes succeed (and it then fails upon the first call), but just to be sure: if you comment out everything after the session has "joined realm", and let it sit idle, does that work fine?

atimin commented 3 years ago

Thank you for the response. Unfortunately, not. I reduce the program:

boost::asio::io_service io;

  TcpResolver resolver(io);
  TcpResolver::query q(parser.host(), parser.port());
  auto results = resolver.resolve(q);

  auto endpoint = results.begin()->endpoint();

  auto debug = static_cast<std::string>(log_level) == "DEBUG";
  auto transport =
      std::make_shared<autobahn::wamp_tcp_transport>(io, endpoint, debug);

  auto session = std::make_shared<autobahn::wamp_session>(io, debug);
  transport->attach(
      std::static_pointer_cast<autobahn::wamp_transport_handler>(session));

  boost::future<void> connect_future;
  boost::future<void> start_future;
  boost::future<void> join_future;

  connect_future = transport->connect().then([&](auto started) {
    try {
      started.get();
    } catch (const std::exception& e) {
      LOG_ERROR() << e.what();
      io.stop();
      return;
    }

    LOG_INFO() << "Connected with " << wamp_router;

    start_future = session->start().then([&](auto started) {
      try {
        started.get();
      } catch (const std::exception& e) {
        LOG_ERROR() << e.what();
        io.stop();
        return;
      }

      LOG_INFO() << "Start WAMP session";
      join_future =
          session->join(static_cast<std::string>("adt"))
              .then([&](boost::future<uint64_t> joined) {
                try {
                  LOG_INFO() << "joined realm: " << joined.get();
                } catch (const std::exception& e) {
                  LOG_ERROR() << e.what();
                  io.stop();
                  return;
                }
              });

    });
  });

  io.run();

  LOG_INFO() << "Graceful exit";
  return 0;

And have the same error in the router's logs

oberstet commented 3 years ago

ok, in this case, I would first further bisect the problem - you could try these included examples:

c++ caller vs c++ callee, and the second shows websocket vs rawsocket


the other path to explore is to tune up log level in crossbar to find out why it runs into "WAMP ProtocolError - aborting connection" .. what is the client sending that is a protocol error?

atimin commented 3 years ago

This is the logs with level trace:

crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol(addr=IPv4Address(type='TCP', host='172.22.0.1', port=47710))
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol() -> proto=<crossbar.router.protocol.WampRawSocketServerProtocol object at 0x7fc9688791d0>, max_message_size=16777216, MAX_LENGTH=16777216
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionMade()
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake received - 0x7ff20000
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: correct magic byte received
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client requests us to send out most 16777216 bytes per message
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client wants to use serializer '2'
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): calling <bound method RouterSession.onOpen of <crossbar.router.session.RouterSession object at 0x7fc968968f90>>
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.session.RouterSession] Client session connected - transport: {'type': 'rawsocket', 'protocol': 'wamp.2.msgpack', 'peer': 'tcp4:172.22.0.1:47710', 'channel_id': '0000000000000000000000000000000000000000000000000000000000000000'}
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): <crossbar.router.session.RouterSession object at 0x7fc968968f90> started (res=None).
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake completed: <autobahn.wamp.serializer.MsgPackSerializer object at 0x7fc96889d510>
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived(): RX 9301a361647493a6617574686964a0ab617574686d6574686f647390a5726f6c657394aa7375627363726962657290a97075626c697368657290a663616c6c656591a8666561747572657391ac63616c6c5f74696d656f7574c3a663616c6c657291a8666561747572657391ac63616c6c5f74696d656f7574c3 octets
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection!
crossbar_1  | invalid serialization of WAMP message: ExtraData unpack(b) received extra data.
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionLost(reason="[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
crossbar_1  | ]"
crossbar_1  | 2021-06-01T14:19:12+0000 [Router         21 crossbar.router.session.RouterSession] RouterSession.onClose(was_clean=False)

I'm trying to build the examples.

atimin commented 3 years ago

Okay, I've built the examples and have the same problem for caller.cpp:

crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol(addr=IPv4Address(type='TCP', host='172.22.0.1', port=47876))
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol() -> proto=<crossbar.router.protocol.WampRawSocketServerProtocol object at 0x7fc9688594d0>, max_message_size=16777216, MAX_LENGTH=16777216
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionMade()
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake received - 0x7ff20000
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: correct magic byte received
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client requests us to send out most 16777216 bytes per message
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client wants to use serializer '2'
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): calling <bound method RouterSession.onOpen of <crossbar.router.session.RouterSession object at 0x7fc968859950>>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] Client session connected - transport: {'type': 'rawsocket', 'protocol': 'wamp.2.msgpack', 'peer': 'tcp4:172.22.0.1:47876', 'channel_id': '0000000000000000000000000000000000000000000000000000000000000000'}
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): <crossbar.router.session.RouterSession object at 0x7fc968859950> started (res=None).
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake completed: <autobahn.wamp.serializer.MsgPackSerializer object at 0x7fc968859790>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived(): RX 9301a361647493a6617574686964a0a5726f6c657394a97075626c697368657290a663616c6c657291a8666561747572657391ac63616c6c5f74696d656f7574c3aa7375627363726962657290a663616c6c656591a8666561747572657391ac63616c6c5f74696d656f7574c3ab617574686d6574686f647390 octets
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection!
crossbar_1  | invalid serialization of WAMP message: ExtraData unpack(b) received extra data.
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionLost(reason="[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
crossbar_1  | ]"
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] RouterSession.onClose(was_clean=False)

for websocket_calee.cpp

crossbar_1  | msgpack.exceptions.ExtraData: unpack(b) received extra data.
crossbar_1  | 
crossbar_1  | During handling of the above exception, another exception occurred:
crossbar_1  | 
crossbar_1  | Traceback (most recent call last):
crossbar_1  |   File "/usr/local/lib/python3.7/site-packages/autobahn/wamp/websocket.py", line 88, in onMessage
crossbar_1  |     for msg in self._serializer.unserialize(payload, isBinary):
crossbar_1  |   File "/usr/local/lib/python3.7/site-packages/autobahn/wamp/serializer.py", line 277, in unserialize
crossbar_1  |     raise ProtocolError("invalid serialization of WAMP message: {0} {1}".format(type(e).__name__, e))
crossbar_1  | autobahn.wamp.exception.ProtocolError: invalid serialization of WAMP message: ExtraData unpack(b) received extra data.
crossbar_1  | 
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] Failing WAMP-over-WebSocket transport: code=1002, reason="WAMP Protocol Error (invalid serialization of WAMP message: ExtraData unpack(b) received extra data.)"
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] failing WebSocket connection (code=1002): "WAMP Protocol Error (invalid serialization of WAMP message: ExtraData unpack(b) received extra data.)"
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] dropping connection to peer tcp4:172.22.0.1:60624 with abort=True
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] Connection to/from tcp4:172.22.0.1:60624 was aborted locally
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
crossbar_1  | ]
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.protocol.WampWebSocketServerProtocol] WAMP-over-WebSocket transport lost: wasClean=True, code=1002, reason="WAMP Protocol Error (invalid serialization of WAMP message: ExtraData unpack(b) received extra data.)"
crossbar_1  | 2021-06-01T14:29:03+0000 [Router         21 crossbar.router.session.RouterSession] RouterSession.onClose(was_clean=True)
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol(addr=IPv4Address(type='TCP', host='172.22.0.1', port=47876))
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol() -> proto=<crossbar.router.protocol.WampRawSocketServerProtocol object at 0x7fc9688594d0>, max_message_size=16777216, MAX_LENGTH=16777216
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionMade()
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake received - 0x7ff20000
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: correct magic byte received
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client requests us to send out most 16777216 bytes per message
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client wants to use serializer '2'
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): calling <bound method RouterSession.onOpen of <crossbar.router.session.RouterSession object at 0x7fc968859950>>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] Client session connected - transport: {'type': 'rawsocket', 'protocol': 'wamp.2.msgpack', 'peer': 'tcp4:172.22.0.1:47876', 'channel_id': '0000000000000000000000000000000000000000000000000000000000000000'}
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): <crossbar.router.session.RouterSession object at 0x7fc968859950> started (res=None).
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake completed: <autobahn.wamp.serializer.MsgPackSerializer object at 0x7fc968859790>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived(): RX 9301a361647493a6617574686964a0a5726f6c657394a97075626c697368657290a663616c6c657291a8666561747572657391ac63616c6c5f74696d656f7574c3aa7375627363726962657290a663616c6c656591a8666561747572657391ac63616c6c5f74696d656f7574c3ab617574686d6574686f647390 octets
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection!
crossbar_1  | invalid serialization of WAMP message: ExtraData unpack(b) received extra data.
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionLost(reason="[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
crossbar_1  | ]"
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] RouterSession.onClose(crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol(addr=IPv4Address(type='TCP', host='172.22.0.1', port=47876))
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerFactory] WampRawSocketServerFactory.buildProtocol() -> proto=<crossbar.router.protocol.WampRawSocketServerProtocol object at 0x7fc9688594d0>, max_message_size=16777216, MAX_LENGTH=16777216
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionMade()
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake received - 0x7ff20000
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: correct magic byte received
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client requests us to send out most 16777216 bytes per message
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: client wants to use serializer '2'
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): calling <bound method RouterSession.onOpen of <crossbar.router.session.RouterSession object at 0x7fc968859950>>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] Client session connected - transport: {'type': 'rawsocket', 'protocol': 'wamp.2.msgpack', 'peer': 'tcp4:172.22.0.1:47876', 'channel_id': '0000000000000000000000000000000000000000000000000000000000000000'}
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol._on_handshake_complete(): <crossbar.router.session.RouterSession object at 0x7fc968859950> started (res=None).
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol: opening handshake completed: <autobahn.wamp.serializer.MsgPackSerializer object at 0x7fc968859790>
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived(): RX 9301a361647493a6617574686964a0a5726f6c657394a97075626c697368657290a663616c6c657291a8666561747572657391ac63616c6c5f74696d656f7574c3aa7375627363726962657290a663616c6c656591a8666561747572657391ac63616c6c5f74696d656f7574c3ab617574686d6574686f647390 octets
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.stringReceived: WAMP ProtocolError - aborting connection!
crossbar_1  | invalid serialization of WAMP message: ExtraData unpack(b) received extra data.
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.protocol.WampRawSocketServerProtocol] WampRawSocketServerProtocol.connectionLost(reason="[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally using ITCPTransport.abortConnection.
crossbar_1  | ]"
crossbar_1  | 2021-06-01T14:30:39+0000 [Router         21 crossbar.router.session.RouterSession] RouterSession.onClose(was_clean=False)

was_clean=False)

I guess something with Msgpack. I've installed it by using apt install command on ubuntu-20.04. Maybe the version is not proper. Btw. I didn't find them in cmake log, however I manged to build the example:

16:24 $ cmake ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")  
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0") found components: program_options system thread random 
-- AUTOBAHN_BUILD_EXAMPLES:  ON
-- AUTOBAHN_USE_LIBCXX:      ON
-- CMAKE_ROOT:               /snap/cmake/876/share/cmake-3.20
-- CMAKE_INSTALL_PREFIX:     /usr/local
-- Boost_INCLUDE_DIRS:       /usr/include
-- Boost_LIBRARIES:          Boost::program_optionsBoost::systemBoost::threadBoost::random
-- msgpack_INCLUDE_DIRS:     
-- msgpack_LIBRARIES:        
-- websocketpp_INCLUDE_DIRS: 
-- websocketpp_LIBRARIES:    
-- Configuring done
-- Generating done
-- Build files have been written to: /home/atimin/Projects/AnomalyDetectionTrainer/core/cmake-build-debug/_deps/autobahn-src/build
oberstet commented 3 years ago

yes, this is raised from here https://github.com/crossbario/autobahn-python/blob/fd5530cecff0be210b148bddf1e984ed31d2863c/autobahn/wamp/serializer.py#L276

and this is trying to deserialize in python msgpack from wire bytes .. and that fails with some low level msgpack serialization/deserialization issue. since you have JS working as well, I would first suspect msgpack on c++ side is going wrong somehow ...

atimin commented 3 years ago

Yep, that was the reason. I've reinstalled msgpack from sources and it's working now. Thank you fro your help!

oberstet commented 3 years ago

great, glad it works for you now!