diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2022-05-25 11:40:12 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2022-05-25 11:40:12 +0000 |
commit | 8a714b77eab4644371cc04da1fe8e7bc1bc7952a (patch) | |
tree | 9ae4cdb1b9fe5b07c3e54665816b84712d8ae2de /messagebus/src | |
parent | d0824fc978da7240f9a16a3fb4197b21628d9abc (diff) |
fix undefined behavior in messagebus unit tests
also avoids hanging/leaving processes after running all unit tests
with UBSAN without recovery.
Diffstat (limited to 'messagebus/src')
4 files changed, 10 insertions, 10 deletions
diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index 919d242fc47..e82e58d1730 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -155,6 +155,7 @@ Test::Main() ssp.setTimeout(400s); SourceSession::UP ss = srcNet.mb.createSourceSession(src, ssp); DestinationSession::UP ds = dstNet.mb.createDestinationSession("session", true, dst); + dst.setDestinationSession(*ds); ASSERT_EQUAL(400s, ssp.getTimeout()); // wait for slobrok registration diff --git a/messagebus/src/vespa/messagebus/network/rpcnetwork.h b/messagebus/src/vespa/messagebus/network/rpcnetwork.h index 3da7d88f994..38f35d1266a 100644 --- a/messagebus/src/vespa/messagebus/network/rpcnetwork.h +++ b/messagebus/src/vespa/messagebus/network/rpcnetwork.h @@ -33,8 +33,7 @@ class RPCServiceAddress; * Network implementation based on RPC. This class is responsible for * keeping track of services and for sending messages to services. **/ -class RPCNetwork : public INetwork, - public FRT_Invokable { +class RPCNetwork : public FRT_Invokable, public INetwork { private: using CompressionConfig = vespalib::compression::CompressionConfig; struct SendContext : public RPCTarget::IVersionHandler { diff --git a/messagebus/src/vespa/messagebus/network/rpcsend.h b/messagebus/src/vespa/messagebus/network/rpcsend.h index 9b2e76a8a21..e548c4adca2 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsend.h +++ b/messagebus/src/vespa/messagebus/network/rpcsend.h @@ -29,8 +29,8 @@ public: virtual void fill(const vespalib::Memory & name, vespalib::slime::Cursor & v) const = 0; }; -class RPCSend : public RPCSendAdapter, - public FRT_Invokable, +class RPCSend : public FRT_Invokable, + public RPCSendAdapter, public FRT_IRequestWait, public IDiscardHandler, public IReplyHandler diff --git a/messagebus/src/vespa/messagebus/routing/routingnode.cpp b/messagebus/src/vespa/messagebus/routing/routingnode.cpp index 30048d9cdd1..2c1de3d31bb 100644 --- a/messagebus/src/vespa/messagebus/routing/routingnode.cpp +++ b/messagebus/src/vespa/messagebus/routing/routingnode.cpp @@ -387,17 +387,17 @@ RoutingNode::lookupRoute() { RoutingTable::SP table = _mbus.getRoutingTable(_msg.getProtocol()); Hop &hop = _route.getHop(0); - const RouteDirective &dir = static_cast<const RouteDirective&>(hop.getDirective(0)); - if (dir.getType() == IHopDirective::TYPE_ROUTE) { + const auto *dir = dynamic_cast<const RouteDirective *>(&hop.getDirective(0)); + if (dir && dir->getType() == IHopDirective::TYPE_ROUTE) { - if (!table || !table->hasRoute(dir.getName())) { - setError(ErrorCode::ILLEGAL_ROUTE, make_string("Route '%s' does not exist.", dir.getName().c_str())); + if (!table || !table->hasRoute(dir->getName())) { + setError(ErrorCode::ILLEGAL_ROUTE, make_string("Route '%s' does not exist.", dir->getName().c_str())); return false; } - insertRoute(*table->getRoute(dir.getName())); + insertRoute(*table->getRoute(dir->getName())); _trace.trace(TraceLevel::SPLIT_MERGE, make_string("Route '%s' retrieved by directive; new route is '%s'.", - dir.getName().c_str(), _route.toString().c_str())); + dir->getName().c_str(), _route.toString().c_str())); return true; } if (table) { |