Giter Site home page Giter Site logo

rest_rpc's Introduction

rest_rpc

OS (Compiler Version) Status
Ubuntu 22.04 (clang 14.0.0) win
Ubuntu 22.04 (gcc 11.2.0) win
macOS Monterey 12 (AppleClang 14.0.0.14000029) win
Windows Server 2022 (MSVC 19.33.31630.0) win

c++11, high performance, cross platform, easy to use rpc framework.

It's so easy to love RPC.

Modern C++开发的RPC库就是这么简单好用!

rest_rpc简介

rest_rpc是一个高性能、易用、跨平台、header only的c++11 rpc库,它的目标是让tcp通信变得非常简单易用,即使不懂网络通信的人也可以直接使用它。它依赖header-only的standalone asio(commit id:f70f65ae54351c209c3a24704624144bfe8e70a3)

可以快速上手,使用者只需要关注自己的业务逻辑即可。

谁在用rest_rpc

  1. 博世汽车
  2. 浙江智网科技
  3. purecpp.org

在这里增加用户

rest_rpc的特点

rest_rpc为用户提供了非常简单易用的接口,几行代码就可以实现rpc通信了,来看第一个例子

一个加法的rpc服务

//服务端注册加法rpc服务

struct dummy{
	int add(rpc_conn conn, int a, int b) { return a + b; }
};

int main(){
	rpc_server server(9000, std::thread::hardware_concurrency());

	dummy d;
	server.register_handler("add", &dummy::add, &d);
	
	server.run();
}
//客户端调用加法的rpc服务
int main(){
	rpc_client client("127.0.0.1", 9000);
	client.connect();

	int result = client.call<int>("add", 1, 2);

	client.run();
}

获取一个对象的rpc服务

//服务端注册获取person的rpc服务

//1.先定义person对象
struct person {
	int id;
	std::string name;
	int age;

	MSGPACK_DEFINE(id, name, age);
};

//2.提供并服务
person get_person(rpc_conn conn) {
	return { 1, "tom", 20 };
}

int main(){
	//...
	server.register_handler("get_person", get_person);
}
//客户端调用获取person对象的rpc服务
int main(){
	rpc_client client("127.0.0.1", 9000);
	client.connect();
	
	person result = client.call<person>("get_person");
	std::cout << result.name << std::endl;
	
	client.run();
}

异步?

同步?

future?

callback?

当初为了提供什么样的接口在社区群里还争论了一番,有人希望提供callback接口,有人希望提供future接口,最后我 决定都提供,专治强迫症患者:)

现在想要的这些接口都给你提供了,你想用什么类型的接口就用什么类型的接口,够酷吧,让我们来看看怎么用这些接口吧:

//服务端提供echo服务
std::string echo(rpc_conn conn, const std::string& src) {
	return src;
}

server.register_handler("echo", echo);

客户端同步接口

auto result = client.call<std::string>("echo", "hello");

客户端异步回调接口

client.async_call("echo", [](asio::error_code ec, string_view data){
	auto str = as<std::string>(data);
	std::cout << "echo " << str << '\n';
});

async_call接口说明

有两个重载的async_call接口,一个是返回future的接口,一个是带超时的异步接口。

返回future的async_call接口:

std::future<std::string> future = client.async_call<CallModel::future>("echo", "purecpp");

带超时的异步回调接口:

async_call<timeout_ms>("some_rpc_service_name", callback, service_args...);

如果不显式设置超时时间的话,则会用默认的5s超时.

async_call("some_rpc_service_name", callback, args...);
client.async_call("echo", [](asio::error_code ec, string_view data) {
    if (ec) {                
        std::cout << ec.message() <<" "<< data << "\n";
        return;
    }

    auto result = as<std::string>(data);
    std::cout << result << " async\n";
}, "purecpp");

客户端异步future接口

auto future = client->async_call<FUTURE>("echo", "hello");
auto status = future.wait_for(std::chrono::seconds(2));
if (status == std::future_status::timeout) {
	std::cout << "timeout\n";
}
else if (status == std::future_status::ready) {
	auto str = future.get().as<std::string>();
	std::cout << "echo " << str << '\n';
}

除了上面的这些很棒的接口之外,更酷的是rest_rpc还支持了订阅发布的功能,这是目前很多rpc库做不到的。

服务端订阅发布的例子在这里:

https://github.com/qicosmos/rest_rpc/blob/master/examples/server/main.cpp#L121 https://github.com/qicosmos/rest_rpc/blob/master/examples/client/main.cpp#L383

rest_rpc是目前最快的rpc库,具体和grpc和brpc做了性能对比测试,rest_rpc性能是最高的,远超grpc。

性能测试的结果在这里:

https://github.com/qicosmos/rest_rpc/blob/master/doc/%E5%8D%95%E6%9C%BA%E4%B8%8Arest_rpc%E5%92%8Cbrpc%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95.md

rest_rpc的更多用法

可以参考rest_rpc的example:

https://github.com/qicosmos/rest_rpc/tree/master/examples

future

make an IDL tool to genrate the client code.

社区和群

purecpp.cn

qq群:546487929

rest_rpc's People

Contributors

bluerabbity avatar bryainzhang avatar dependabot[bot] avatar jacyking avatar jandai avatar jandai-xx avatar jovany-wang avatar qicosmos avatar try-agaaain avatar zhengjian526 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rest_rpc's Issues

能否使用引用传递参数?

例如
struct person{ string name; int age; }; void test_person(person& per) { per.name = "aaa"; }
请问这种情况是否支持?
在librpc中可以使用 person& test_person(person& per) { return per;}来完成

增加ASIO的隔离

原来的代码已经在使用ASIO库了,用的io_context而不是io_service,所以使用方式不一样。
能否增加一下实现隔离或者修改为使用io_context的方式?
或者用Impl的方式隐藏ASIO的使用?

客户端能否维护一个长连接,提供一个推送通知回调,以实现推送功能?

对于客户端网络库业务使用来说,其实就两种形式:一种主动请求(又分同步和异步),一种被动推送。
rest_rpc解决了主动请求的问题,调用确实挺方便!
但我觉着rest_rpc不应该局限在rpc这个技术名词的意思,还应该把客户端推送也集成并且优雅的解决好,这样就全统一了,才是真正的解决问题。
服务端可选择的框架方案太多了,就是分布式,mq都有很好的方案。而客户端网络库都没人关注和做的好的,这篇文章我觉得很有道理:https://blog.51cto.com/yaocoder/1541271
要么只是封装下socket提供几个回调,当然rest_rpc算是考虑到实际调用方便,主动请求解决的挺好,但缺长连接维持和推送通知。客户端库当然还需要考虑依赖尽可能少,库尽可能小,性能第二,易用性傻瓜性第一。

rpc_server不支持订阅数据

rpc_server不支持订阅数据么?客户端和服务端实现双工通信,rpc_client支持发布订阅,rpc_server怎么实现订阅呢?

大哥救急 cmake找不到jni

错误提示如下:
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)

但是我java确实是安装了 带上路径也不行

增加trace功能

统一的trace机制,可以trace请求和调用的各种信息。

发布订阅的正确示例是怎样的?

发布订阅的正确示例是怎样的?

我是这样理解的,但貌似不对。关于这块的文档注释基本没有,示例代码对我而言有些晦涩,遇到问题挺抓瞎的。劳烦大大给讲解下。

// 客户端订阅数据。

rpc_client client("127.0.0.1", 9000);
// 启用自动重连。
client.enable_auto_reconnect();
// 启用自动心跳。
client.enable_auto_heartbeat();
client.connect();
// 订阅数据。
client.subscribe("key", [](person p) 
{
	std::cout << p.name << "\n";
});
// 服务端发布数据。

// 1.先定义person对象。
struct person {
	int id;
	std::string name;
	int age;

	MSGPACK_DEFINE(id, name, age);
};

rpc_server server(9000, std::thread::hardware_concurrency());
// 2.发布数据。
server.publish("key", p);
// 同步运行rpc服务,会阻塞当前线程,需异步调用run,或者直接使用asyc_run。
server.run();

完善rest_rpc开发文档

都说开发文档是一个开源项目战斗力的体现,rest_rpc虽然上手简单,但是对于新手或者某些公司开源委员会评估来说,很容易望而却步。
相信看过隔壁brpc的都觉得文档一级棒,堪称典范,光看文档就能规避很多代码错误,减少了不必要的issues。但是不支持Windows!相比之下,rest_rpc更加轻量,跨平台,是不少场景的最佳选择。故希望项目大大完善文档。

端口复用问题

terminate called after throwing an instance of 'boost::wrapexceptboost::system::system_error'
what(): bind: Address already in use
在linux底下杀掉进程再重新启动进程,会提示端口被复用,这个要怎么加入可复用的参数

错误:样例程序,注册类成员函数,返回结构型变量时,编译出错!

开发环境:VS2017 + boost_1_75_0 , Win10专业版

原样例文档:(修改部分)

struct person {
int id;
std::string name;
int age;

MSGPACK_DEFINE(id, name, age);

};

//测试名称空间
namespace tns {

   //原样例类,增加测试函数test
   struct dummy {

	int add(rpc_conn conn, int a, int b) {
		return a + b;
	}

	//================================
	//测试名称空间下的类,返回结构数据
	person test(int a) {
		person p;
		return p;
	}
	//================================
};

}

//调用部分
rpc_server server(9000, std::thread::hardware_concurrency());

tns::dummy *d=new tns::dummy();

//server.register_handler("add", &tns::dummy::add, d); /返回非结构变量,正常/

//=====================================================
//下例注册函数编译提示:
//error C2672: “rest_rpc::rpc_service::router::call_member”: 未找到匹配的重载函数
//=====================================================
server.register_handler("test",&tns::dummy::test, d);
//=====================================================

详细出错内容:
1>d:\rest_rpc\rest_rpc\router.h(151): error C2672: “rest_rpc::rpc_service::router::call_member”: 未找到匹配的重载函数
1>d:\rest_rpc\rest_rpc\router.h(175): note: 参见对正在编译的函数 模板 实例化“void rest_rpc::rpc_service::router::invoker<Function,rest_rpc::ExecMode::sync>::apply_member<rest_rpc::ExecMode::sync,Self>(const Function &,Self *,std::weak_ptr<rest_rpc::rpc_service::connection>,const char ,size_t,std::string &,rest_rpc::ExecMode &)”的引用
1> with
1> [
1> Function=person (__thiscall tns::dummy::
)(int),
1> Self=tns::dummy
1> ]
1>d:\rest_rpc\rest_rpc\router.h(172): note: 参见对正在编译的函数 模板 实例化“void rest_rpc::rpc_service::router::invoker<Function,rest_rpc::ExecMode::sync>::apply_member<rest_rpc::ExecMode::sync,Self>(const Function &,Self ,std::weak_ptr<rest_rpc::rpc_service::connection>,const char ,size_t,std::string &,rest_rpc::ExecMode &)”的引用
1> with
1> [
1> Function=person (__thiscall tns::dummy::
)(int),
1> Self=tns::dummy
1> ]
1>d:\rest_rpc\rest_rpc\router.h(25): note: 参见对正在编译的函数 模板 实例化“void rest_rpc::rpc_service::router::register_member_func<rest_rpc::ExecMode::sync,Function,Self>(const std::string &,const Function &,Self )”的引用
1> with
1> [
1> Function=person (__thiscall tns::dummy::
)(int),
1> Self=tns::dummy
1> ]
1>d:\rest_rpc\rest_rpc\rpc_server.h(86): note: 参见对正在编译的函数 模板 实例化“void rest_rpc::rpc_service::router::register_handler<rest_rpc::ExecMode::sync,Function,Self>(const std::string &,const Function &,Self )”的引用
1> with
1> [
1> Function=person (__thiscall tns::dummy::
)(int),
1> Self=tns::dummy
1> ]
1>d:\rest_rpc\examples\server\main.cpp(124): note: 参见对正在编译的函数 模板 实例化“void rest_rpc::rpc_service::rpc_server::register_handler<rest_rpc::ExecMode::sync,person(__thiscall tns::dummy::
)(int),tns::dummy>(const std::string &,const Function &,Self )”的引用
1> with
1> [
1> Function=person (__thiscall tns::dummy::
)(int),
1> Self=tns::dummy
1> ]
1>d:\boost_1_75_0\boost\asio\use_future.hpp(139): note: 参见对正在编译的 类 模板 实例化 "boost::asio::use_future_t<std::allocator>::std_allocator_void" 的引用
1>d:\boost_1_75_0\boost\asio\use_future.hpp(147): note: 参见对正在编译的 类 模板 实例化 "boost::asio::use_future_t<std::allocator>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\relationship.hpp(268): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::relationship_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\relationship.hpp(309): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::relationship_t" 的引用
1>d:\boost_1_75_0\boost\asio\execution\outstanding_work.hpp(269): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::outstanding_work_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\outstanding_work.hpp(311): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::outstanding_work_t" 的引用
1>d:\boost_1_75_0\boost\asio\execution\occupancy.hpp(123): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::occupancy_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\mapping.hpp(315): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::mapping_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\mapping.hpp(377): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::mapping_t" 的引用
1>d:\boost_1_75_0\boost\asio\execution\context.hpp(130): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::context_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\bulk_guarantee.hpp(321): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::bulk_guarantee_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\bulk_guarantee.hpp(385): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::bulk_guarantee_t" 的引用
1>d:\boost_1_75_0\boost\asio\execution\blocking_adaptation.hpp(276): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::blocking_adaptation_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\blocking_adaptation.hpp(318): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::blocking_adaptation_t" 的引用
1>d:\boost_1_75_0\boost\asio\execution\blocking.hpp(331): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::blocking_t<0>" 的引用
1>d:\boost_1_75_0\boost\asio\execution\blocking.hpp(393): note: 参见对正在编译的 类 模板 实例化 "boost::asio::execution::detail::blocking_t" 的引用
1>d:\rest_rpc\rest_rpc\router.h(151): error C2893: 未能使函数模板“std::enable_if<std::is_void<std::result_of<F(Self,std::weak_ptr<rest_rpc::rpc_service::connection>,Args...)>::type>::value,void>::type rest_rpc::rpc_service::router::call_member(const F &,Self *,std::weak_ptr<rest_rpc::rpc_service::connection>,std::string &,std::tuple<Arg,Args...>)”专用化
1>d:\rest_rpc\rest_rpc\router.h(151): note: 用下列模板参数:
1>d:\rest_rpc\rest_rpc\router.h(151): note: “F=Function”
1>d:\rest_rpc\rest_rpc\router.h(151): note: “Self=Self”
1>d:\rest_rpc\rest_rpc\router.h(151): note: “Arg=std::basic_string<char,std::char_traits,std::allocator>”
1>d:\rest_rpc\rest_rpc\router.h(151): note: “Args={}”
1>已完成生成项目“basic_server.vcxproj”的操作 - 失败。

basic_server崩溃

开发环境. centos 7 && gcc 8.3
操作步骤

  1. 启动basic_server
  2. 启动basic_client 等待3-5秒 ctrl+c关闭client. 重复这个操作 正常是2次 出现.

rest_rpc

客户端在订阅中调用发布会超时

void test_sub1() {
rpc_client client;
client.enable_auto_reconnect();
client.enable_auto_heartbeat();
bool r = client.connect("127.0.0.1", 9000);
if (!r) {
return;
}

client.subscribe(
"key", "048a796c8a3c6a6b7bd1223bf2c8cee05232e927b521984ba417cb2fca6df9d1",
[](string_view data) {
msgpack_codec codec;
person p = codec.unpack(data.data(), data.size());
std::cout << p.name << "\n";
test_performance1();
});

}

使用测试程序test_performance1();会报timeout or deferred

rpc_client 重复测试会崩溃

写个死循环不断跑,到了一定时间,必定崩溃:

void test() {
  try {
    rpc_client client("127.0.0.1", 9000);
    bool r = client.connect();
    if (!r) {
      std::cout << "connect timeout" << std::endl;
      return;
    }

    {
      auto result = client.call<2000, std::string>("test", "Hello");
      std::cout << "test result: " << result << std::endl;
    }
  }
  catch (const std::exception & e) {
    std::cout << e.what() << std::endl;
  }
}

int main(int argc, const char * argv[]) {
    for (;;) {
      test();
      std::this_thread::sleep_for(std::chrono::milliseconds(1000));
    }
    return 0;
}


支持metric

可以对接metric显示rpc的统计信息。

调用rpc_server的publish函数出现内存泄漏

问题描述

调用rpc_server的publish函数出现内存泄漏,参数为自定义结构体集合,如vector<PclPoint>,size()=200000,详见Demo源码

开发环境

  • VS2019 16.7.6
  • rest_rpc最新版本

Demo操作描述

Demo分为数据发布端Server和数据订阅端Client,分别部署在不同的电脑上。Server启动后即以每秒发布长度为200000的vector数据和长度为20000的vector数据。Client端启动后输入Server端的IP地址,选择订阅的数据类型,开始接收数据。

image-20201016213024927

内存泄漏检测结果

使用Deleaker工具检测结果如图1所示。

image-20201016204514854

​ 图1 Deleaker工具内存泄漏检测结果

使用 Inter Inspector工具检测结果如图2、图3和图4所示。

image-20201016210202990

​ 图2 Inter Inspector工具内存泄漏检测结果1

image-20201016210326048

​ 图3 Inter Inspector工具内存泄漏检测结果2

image-20201016211011385

​ 图4 Inter Inspector工具内存泄漏检测结果3

@qicosmos 劳烦给看看,谢谢!

如何移除boost库依赖?

看到作者的提交日志中,最新的版本说是可以移除boost库依赖。请问如何做呢?我已经编译了msgpackc库

rpc_server takes 15sec when exit....

When rpc_server shutdown, it takes 15 sec(check_seconds_ value) at worst case.

So,... How about using condition_variable wait for instead of this_thread::sleep.

`~rpc_server() {
stop_check_ = true;
clean_sig_.notify_one();
check_thread_->join();

void clean() {
while (!stop_check_) {
//std::this_thread::sleep_for(std::chrono::seconds(check_seconds_));
std::unique_lockstd::mutex lock(mtx_);
clean_sig_.wait_for(lock, std::chrono::seconds(check_seconds_));`

客户端可能遗留僵尸promise?

当客户端同步调用超时,抛出 std::out_of_range("timeout or deferred") 之前,并未从 future_map_ 中擦除相应的 promise 对象?

添加注释、消息警告

哪位大佬有时间麻烦处理一下:
1.代码中注释太少,清添加一下。
2.消除代码中的警告信息x64模式下
1>E:\git\boost_1_76_0\boost\rest_rpc\rpc_client.hpp(294,12): warning C4244: 'return': conversion from 'uint64_t' to 'long', possible loss of data
1>E:\git\boost_1_76_0\boost\rest_rpc\rpc_client.hpp(588,36): warning C4244: 'argument': conversion from 'uint64_t' to 'long', possible loss of data
image

Maybe there is deadlock in ~rcp_server()...

I think the lock(std::unique_lockstd::mutex lock(mtx_)) makes deadlock in check_thread_...

		~rpc_server() {
			{
				//std::unique_lock<std::mutex> lock(mtx_);//-jjkim
				stop_check_ = true;
				cv_.notify_all();
				check_thread_->join();
			}

			{
				std::unique_lock<std::mutex> lock(sub_mtx_);
				stop_check_pub_sub_ = true;
                                     lock.unlock();//+jjkim
				sub_cv_.notify_all();
                                    pub_sub_thread_->join();
			}

			io_service_pool_.stop();
			if(thd_){
                thd_->join();
			}
		}

java同步调用以及版本问题

你好!现有java似乎只支持异步调用,可否增加同步调用功能?还有请问java只支持jdk8以上,请问1.6可否有办法使用?
谢谢!

server退出的一些问题

server在运行了run之后,整个进程就被接管了。
1、如何退出server?
2、如何在退出server后完成一些资源释放的代码呢?

Compiler error in Ubuntu

Hi, I try to use rest_rpc in Ubuntu. When I try to run the example provided using the following comments:

~/nethz/study/RPC/rest_rpc/examples/app_client$ gcc main.cpp -I../../include/ ../../third/msgpack/include -pthread -std=c++11
In file included from ../../include/rpc_client.hpp:6:0,
from client.hpp:2,
from main.cpp:2:
../../include/use_asio.hpp:43:41: fatal error: boost/utility/string_view.hpp: No such file or directory
compilation terminated.

Looks like there is no boost/utility/ at all. Any idea to solve this issue? Thanks.

malloc(): smallbin double linked list corrupted: 0x00007f1f0803cf60

*** Error in `./build/service_server': malloc(): smallbin double linked list corrupted: 0x00007f1f0803cf60 ***
====== Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f1f26b457f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x82679)[0x7f1f26b50679]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x54)[0x7f1f26b521d4]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x15)[0x7f1f27156055]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZNSt7promiseIN8rest_rpc10req_resultEEC1Ev+0x3c)[0x7f1f27e5c2c4]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZN9__gnu_cxx13new_allocatorISt7promiseIN8rest_rpc10req_resultEEE9constructIS4_JEEEvPT_DpOT0+0x36)[0x7f1f27e5a6ac]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZNSt16allocator_traitsISaISt7promiseIN8rest_rpc10req_resultEEEE9constructIS3_JEEEvRS4_PT_DpOT0+0x23)[0x7f1f27e57865]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZNSt23_Sp_counted_ptr_inplaceISt7promiseIN8rest_rpc10req_resultEESaIS3_ELN9__gnu_cxx12_Lock_policyE2EEC1IJEEES4_DpOT+0x92)[0x7f1f27e54554]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EEC1ISt7promiseIN8rest_rpc10req_resultEESaIS7_EJEEESt19_Sp_make_shared_tagPT_RKT0_DpOT1+0xaf)[0x7f1f27e5098b]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZNSt12__shared_ptrISt7promiseIN8rest_rpc10req_resultEELN9__gnu_cxx12_Lock_policyE2EEC1ISaIS3_EJEEESt19_Sp_make_shared_tagRKT_DpOT0+0x3c)[0x7f1f27e4cab0]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZNSt10shared_ptrISt7promiseIN8rest_rpc10req_resultEEEC2ISaIS3_EJEEESt19_Sp_make_shared_tagRKT_DpOT0+0x28)[0x7f1f27e48576]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZSt15allocate_sharedISt7promiseIN8rest_rpc10req_resultEESaIS3_EJEESt10shared_ptrIT_ERKT0_DpOT1+0x37)[0x7f1f27e446ae]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZSt11make_sharedISt7promiseIN8rest_rpc10req_resultEEJEESt10shared_ptrIT_EDpOT0+0x3b)[0x7f1f27e3fc8b]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZN8rest_rpc10rpc_client10async_callILNS_9CallModelE0EJEEESt6futureINS_10req_resultEERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT0+0x3c)[0x7f1f27e69d92]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZN8rest_rpc10rpc_client4callILm5000EN8bz_robot6RetMsgINS2_11GridMapDataEEEJEEENSt9enable_ifIXntsrSt7is_voidIT0_E5valueES8_E4typeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT1+0x43)[0x7f1f27e7ae6d]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZN8rest_rpc10rpc_client4callIN8bz_robot6RetMsgINS2_11GridMapDataEEEJEEENSt9enable_ifIXntsrSt7is_voidIT_E5valueES8_E4typeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT0+0x3a)[0x7f1f27e79468]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZN8bz_robot14TaskNavigation9local_mapEv+0x207)[0x7f1f27e789bb]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZN8bz_robot14TaskNavigation10local_planEv+0x2c0)[0x7f1f27e74980]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(+0x7c7457)[0x7f1f27e77457]
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5(event_base_loop+0x819)[0x7f1f263de4c9]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZN8bz_robot14TaskNavigation3runEv+0x212)[0x7f1f27e73172]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZN8bz_robot11TaskManager13running_tasksEv+0x1a3)[0x7f1f27e2be93]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZSt13__invoke_implIbMN8bz_robot11TaskManagerEFbvEPS1_JEET_St21__invoke_memfun_derefOT0_OT1_DpOT2+0x67)[0x7f1f27e459fa]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(ZSt8__invokeIMN8bz_robot11TaskManagerEFbvEJPS1_EENSt15__invoke_resultIT_JDpT0_EE4typeEOS6_DpOS7+0x4e)[0x7f1f27e40ea3]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZNSt6thread8_InvokerISt5tupleIJMN8bz_robot11TaskManagerEFbvEPS3_EEE9_M_invokeIJLm0ELm1EEEEDTcl8__invokespcl10_S_declvalIXT_EEEEESt12_Index_tupleIJXspT_EEE+0x43)[0x7f1f27e6756d]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZNSt6thread8_InvokerISt5tupleIJMN8bz_robot11TaskManagerEFbvEPS3_EEEclEv+0x2c)[0x7f1f27e66dba]
/home/zhou/work/bz_robot2/build/libbz_robot2_lib.so(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJMN8bz_robot11TaskManagerEFbvEPS4_EEEEE6_M_runEv+0x1c)[0x7f1f27e65d9a]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xd0b10)[0x7f1f27180b10]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f1f2749a6ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f1f26bd54dd]
======= Memory map: ========
00400000-006a8000 r-xp 00000000 08:12 6316827 /home/zhou/work/bz_robot2/build/service_server
008a8000-008ac000 r--p 002a8000 08:12 6316827 /home/zhou/work/bz_robot2/build/service_server
008ac000-008ad000 rw-p 002ac000 08:12 6316827 /home/zhou/work/bz_robot2/build/service_server
008ad000-008ae000 rw-p 00000000 00:00 0
01ad0000-01b12000 rw-p 00000000 00:00 0 [heap]
7f1edc000000-7f1edc021000 rw-p 00000000 00:00 0
7f1edc021000-7f1ee0000000 ---p 00000000 00:00 0
7f1ee0000000-7f1ee0021000 rw-p 00000000 00:00 0
7f1ee0021000-7f1ee4000000 ---p 00000000 00:00 0
7f1ee4000000-7f1ee4021000 rw-p 00000000 00:00 0
7f1ee4021000-7f1ee8000000 ---p 00000000 00:00 0
7f1ee8000000-7f1ee803c000 rw-p 00000000 00:00 0
7f1ee803c000-7f1eec000000 ---p 00000000 00:00 0
7f1eec000000-7f1eec021000 rw-p 00000000 00:00 0
7f1eec021000-7f1ef0000000 ---p 00000000 00:00 0
7f1ef0000000-7f1ef0021000 rw-p 00000000 00:00 0
7f1ef0021000-7f1ef4000000 ---p 00000000 00:00 0
7f1ef4000000-7f1ef4021000 rw-p 00000000 00:00 0
7f1ef4021000-7f1ef8000000 ---p 00000000 00:00 0
7f1ef8000000-7f1ef8021000 rw-p 00000000 00:00 0
7f1ef8021000-7f1efc000000 ---p 00000000 00:00 0
7f1efc000000-7f1efc021000 rw-p 00000000 00:00 0
7f1efc021000-7f1f00000000 ---p 00000000 00:00 0
7f1f00000000-7f1f00021000 rw-p 00000000 00:00 0
7f1f00021000-7f1f04000000 ---p 00000000 00:00 0
7f1f04000000-7f1f04021000 rw-p 00000000 00:00 0
7f1f04021000-7f1f08000000 ---p 00000000 00:00 0
7f1f08000000-7f1f0890a000 rw-p 00000000 00:00 0
7f1f0890a000-7f1f0c000000 ---p 00000000 00:00 0
7f1f0f7ff000-7f1f0f800000 ---p 00000000 00:00 0
7f1f0f800000-7f1f10000000 rw-p 00000000 00:00 0
7f1f10000000-7f1f10021000 rw-p 00000000 00:00 0
7f1f10021000-7f1f14000000 ---p 00000000 00:00 0
7f1f147f9000-7f1f147fa000 ---p 00000000 00:00 0
7f1f147fa000-7f1f14ffa000 rw-p 00000000 00:00 0
7f1f14ffa000-7f1f14ffb000 ---p 00000000 00:00 0
7f1f14ffb000-7f1f157fb000 rw-p 00000000 00:00 0
7f1f157fb000-7f1f157fc000 ---p 00000000 00:00 0
7f1f157fc000-7f1f15ffc000 rw-p 00000000 00:00 0
7f1f15ffc000-7f1f15ffd000 ---p 00000000 00:00 0
7f1f15ffd000-7f1f167fd000 rw-p 00000000 00:00 0
7f1f167fd000-7f1f167fe000 ---p 00000000 00:00 0
7f1f167fe000-7f1f16ffe000 rw-p 00000000 00:00 0
7f1f16ffe000-7f1f16fff000 ---p 00000000 00:00 0
7f1f16fff000-7f1f177ff000 rw-p 00000000 00:00 0
7f1f177ff000-7f1f17800000 ---p 00000000 00:00 0
7f1f17800000-7f1f18000000 rw-p 00000000 00:00 0
7f1f18000000-7f1f18021000 rw-p 00000000 00:00 0
7f1f18021000-7f1f1c000000 ---p 00000000 00:00 0
7f1f1c54f000-7f1f1c550000 ---p 00000000 00:00 0
7f1f1c550000-7f1f1cd50000 rw-p 00000000 00:00 0
7f1f1cd50000-7f1f1cd51000 ---p 00000000 00:00 0
7f1f1cd51000-7f1f1d551000 rw-p 00000000 00:00 0
7f1f1d551000-7f1f1d552000 ---p 00000000 00:00 0
7f1f1d552000-7f1f1dd52000 rw-p 00000000 00:00 0
7f1f1dd52000-7f1f1dd53000 ---p 00000000 00:00 0
7f1f1dd53000-7f1f1e553000 rw-p 00000000 00:00 0
7f1f1e553000-7f1f1e554000 ---p 00000000 00:00 0
7f1f1e554000-7f1f1ed54000 rw-p 00000000 00:00 0
7f1f1ed54000-7f1f1ed55000 ---p 00000000 00:00 0
7f1f1ed55000-7f1f1f555000 rw-p 00000000 00:00 0
7f1f1f555000-7f1f1f556000 ---p 00000000 00:00 0
7f1f1f556000-7f1f1fd56000 rw-p 00000000 00:00 0
7f1f1fd56000-7f1f1fd57000 ---p 00000000 00:00 0
7f1f1fd57000-7f1f20557000 rw-p 00000000 00:00 0
7f1f20557000-7f1f20558000 ---p 00000000 00:00 0
7f1f20558000-7f1f20d58000 rw-p 00000000 00:00 0
7f1f20d58000-7f1f20d82000 r-xp 00000000 08:12 2630477 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8
7f1f20d82000-7f1f20f81000 ---p 0002a000 08:12 2630477 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8
7f1f20f81000-7f1f20f82000 r--p 00029000 08:12 2630477 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8
7f1f20f82000-7f1f20f83000 rw-p 0002a000 08:12 2630477 /usr/lib/x86_64-linux-gnu/libvorbis.so.0.4.8
7f1f20f83000-7f1f20f8a000 r-xp 00000000 08:12 2630125 /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2
7f1f20f8a000-7f1f2118a000 ---p 00007000 08:12 2630125 /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2
7f1f2118a000-7f1f2118b000 r--p 00007000 08:12 2630125 /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2
7f1f2118b000-7f1f2118c000 rw-p 00008000 08:12 2630125 /usr/lib/x86_64-linux-gnu/libogg.so.0.8.2
7f1f2118c000-7f1f2119e000 r-xp 00000000 08:12 6820655 /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0
7f1f2119e000-7f1f2139e000 ---p 00012000 08:12 6820655 /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0
7f1f2139e000-7f1f2139f000 r--p 00012000 08:12 6820655 /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0
7f1f2139f000-7f1f213a0000 rw-p 00013000 08:12 6820655 /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0
7f1f213a0000-7f1f2140e000 r-xp 00000000 08:12 6820738 /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f1f2140e000-7f1f2160e000 ---p 0006e000 08:12 6820738 /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f1f2160e000-7f1f2160f000 r--p 0006e000 08:12 6820738 /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f1f2160f000-7f1f21610000 rw-p 0006f000 08:12 6820738 /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f1f21610000-7f1f21627000 r-xp 00000000 08:12 6823308 /lib/x86_64-linux-gnu/libresolv-2.23.so
7f1f21627000-7f1f21827000 ---p 00017000 08:12 6823308 /lib/x86_64-linux-gnu/libresolv-2.23.so
7f1f21827000-7f1f21828000 r--p 00017000 08:12 6823308 /lib/x86_64-linux-gnu/libresolv-2.23.so
7f1f21828000-7f1f21829000 rw-p 00018000 08:12 6823308 /lib/x86_64-linux-gnu/libresolv-2.23.so
7f1f21829000-7f1f2182b000 rw-p 00000000 00:00 0
7f1f2182b000-7f1f218b8000 r-xp 00000000 08:12 2630479 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11
7f1f218b8000-7f1f21ab7000 ---p 0008d000 08:12 2630479 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11
7f1f21ab7000-7f1f21ad3000 r--p 0008c000 08:12 2630479 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11
7f1f21ad3000-7f1f21ad4000 rw-p 000a8000 08:12 2630479 /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2.0.11
7f1f21ad4000-7f1f21b47000 r-xp 00000000 08:12 2629090 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
7f1f21b47000-7f1f21d47000 ---p 00073000 08:12 2629090 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
7f1f21d47000-7f1f21d48000 r--p 00073000 08:12 2629090 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
7f1f21d48000-7f1f21d49000 rw-p 00074000 08:12 2629090 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
7f1f21d49000-7f1f21d5f000 r-xp 00000000 08:12 6823263 /lib/x86_64-linux-gnu/libnsl-2.23.so
7f1f21d5f000-7f1f21f5e000 ---p 00016000 08:12 6823263 /lib/x86_64-linux-gnu/libnsl-2.23.so
7f1f21f5e000-7f1f21f5f000 r--p 00015000 08:12 6823263 /lib/x86_64-linux-gnu/libnsl-2.23.so
7f1f21f5f000-7f1f21f60000 rw-p 00016000 08:12 6823263 /lib/x86_64-linux-gnu/libnsl-2.23.so
7f1f21f60000-7f1f21f62000 rw-p 00000000 00:00 0
7f1f21f62000-7f1f22039000 r-xp 00000000 08:12 6827367 /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5
7f1f22039000-7f1f22239000 ---p 000d7000 08:12 6827367 /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5
7f1f22239000-7f1f2223a000 r--p 000d7000 08:12 6827367 /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5
7f1f2223a000-7f1f22242000 rw-p 000d8000 08:12 6827367 /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5
7f1f22242000-7f1f22243000 rw-p 00000000 00:00 0
7f1f22243000-7f1f22262000 r-xp 00000000 08:12 6820767 /lib/x86_64-linux-gnu/libselinux.so.1
7f1f22262000-7f1f22461000 ---p 0001f000 08:12 6820767 /lib/x86_64-linux-gnu/libselinux.so.1
7f1f22461000-7f1f22462000 r--p 0001e000 08:12 6820767 /lib/x86_64-linux-gnu/libselinux.so.1
7f1f22462000-7f1f22463000 rw-p 0001f000 08:12 6820767 /lib/x86_64-linux-gnu/libselinux.so.1
7f1f22463000-7f1f22465000 rw-p 00000000 00:00 0
7f1f22465000-7f1f2246a000 r-xp 00000000 08:12 2629208 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1f2246a000-7f1f22669000 ---p 00005000 08:12 2629208 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1f22669000-7f1f2266a000 r--p 00004000 08:12 2629208 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1f2266a000-7f1f2266b000 rw-p 00005000 08:12 2629208 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
7f1f2266b000-7f1f2266d000 r-xp 00000000 08:12 2629197 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1f2266d000-7f1f2286d000 ---p 00002000 08:12 2629197 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1f2286d000-7f1f2286e000 r--p 00002000 08:12 2629197 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1f2286e000-7f1f2286f000 rw-p 00003000 08:12 2629197 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
7f1f2286f000-7f1f22874000 r-xp 00000000 08:12 2629295 /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1
7f1f22874000-7f1f22a73000 ---p 00005000 08:12 2629295 /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1
7f1f22a73000-7f1f22a74000 r--p 00004000 08:12 2629295 /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1
7f1f22a74000-7f1f22a75000 rw-p 00005000 08:12 2629295 /usr/lib/x86_64-linux-gnu/libasyncns.so.0.3.1
7f1f22a75000-7f1f22ad8000 r-xp 00000000 08:12 2624379 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f1f22ad8000-7f1f22cd8000 ---p 00063000 08:12 2624379 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f1f22cd8000-7f1f22cda000 r--p 00063000 08:12 2624379 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f1f22cda000-7f1f22cdb000 rw-p 00065000 08:12 2624379 /usr/lib/x86_64-linux-gnu/libsndfile.so.1.0.25
7f1f22cdb000-7f1f22cdf000 rw-p 00000000 00:00 0
7f1f22cdf000-7f1f22ce7000 r-xp 00000000 08:12 6820795 /lib/x86_64-linux-gnu/libwrap.so.0.7.6
7f1f22ce7000-7f1f22ee6000 ---p 00008000 08:12 6820795 /lib/x86_64-linux-gnu/libwrap.so.0.7.6
7f1f22ee6000-7f1f22ee7000 r--p 00007000 08:12 6820795 /lib/x86_64-linux-gnu/libwrap.so.0.7.6
7f1f22ee7000-7f1f22ee8000 rw-p 00008000 08:12 6820795 /lib/x86_64-linux-gnu/libwrap.so.0.7.6
7f1f22ee8000-7f1f22ee9000 rw-p 00000000 00:00 0
7f1f22ee9000-7f1f22ef4000 r-xp 00000000 08:12 2629922 /usr/lib/x86_64-linux-gnu/libjbig.so.0
7f1f22ef4000-7f1f230f3000 ---p 0000b000 08:12 2629922 /usr/lib/x86_64-linux-gnu/libjbig.so.0
7f1f230f3000-7f1f230f4000 r--p 0000a000 08:12 2629922 /usr/lib/x86_64-linux-gnu/libjbig.so.0
7f1f230f4000-7f1f230f7000 rw-p 0000b000 08:12 2629922 /usr/lib/x86_64-linux-gnu/libjbig.so.0
7f1f230f7000-7f1f23118000 r-xp 00000000 08:12 6820678 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f1f23118000-7f1f23317000 ---p 00021000 08:12 6820678 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f1f23317000-7f1f23318000 r--p 00020000 08:12 6820678 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f1f23318000-7f1f23319000 rw-p 00021000 08:12 6820678 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f1f23319000-7f1f23334000 r-xp 00000000 08:12 2777453 /usr/local/lib/libz.so.1.2.11
7f1f23334000-7f1f23533000 ---p 0001b000 08:12 2777453 /usr/local/lib/libz.so.1.2.11
7f1f23533000-7f1f23534000 r--p 0001a000 08:12 2777453 /usr/local/lib/libz.so.1.2.11
7f1f23534000-7f1f23535000 rw-p 0001b000 08:12 2777453 /usr/local/lib/libz.so.1.2.11
7f1f23535000-7f1f2355a000 r-xp 00000000 08:12 6820781 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1f2355a000-7f1f23759000 ---p 00025000 08:12 6820781 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1f23759000-7f1f2375d000 r--p 00024000 08:12 6820781 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1f2375d000-7f1f2375e000 rw-p 00028000 08:12 6820781 /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f1f2375e000-7f1f2378b000 r-xp 00000000 08:12 6820693 /lib/x86_64-linux-gnu/libncursesw.so.5.9
7f1f2378b000-7f1f2398b000 ---p 0002d000 08:12 6820693 /lib/x86_64-linux-gnu/libncursesw.so.5.9
7f1f2398b000-7f1f2398c000 r--p 0002d000 08:12 6820693 /lib/x86_64-linux-gnu/libncursesw.so.5.9
7f1f2398c000-7f1f2398d000 rw-p 0002e000 08:12 6820693 /lib/x86_64-linux-gnu/libncursesw.so.5.9
7f1f2398d000-7f1f23aa7000 r-xp 00000000 08:12 6820770 /lib/x86_64-linux-gnu/libslang.so.2.3.0
7f1f23aa7000-7f1f23ca7000 ---p 0011a000 08:12 6820770 /lib/x86_64-linux-gnu/libslang.so.2.3.0
7f1f23ca7000-7f1f23cab000 r--p 0011a000 08:12 6820770 /lib/x86_64-linux-gnu/libslang.so.2.3.0
7f1f23cab000-7f1f23cc4000 rw-p 0011e000 08:12 6820770 /lib/x86_64-linux-gnu/libslang.so.2.3.0
7f1f23cc4000-7f1f23d18000 rw-p 00000000 00:00 0
7f1f23d18000-7f1f23d39000 r-xp 00000000 08:12 2630610 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1f23d39000-7f1f23f38000 ---p 00021000 08:12 2630610 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1f23f38000-7f1f23f39000 r--p 00020000 08:12 2630610 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1f23f39000-7f1f23f3a000 rw-p 00021000 08:12 2630610 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
7f1f23f3a000-7f1f23f85000 r-xp 00000000 08:12 6815771 /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6
7f1f23f85000-7f1f24184000 ---p 0004b000 08:12 6815771 /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6
7f1f24184000-7f1f24185000 r--p 0004a000 08:12 6815771 /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6
7f1f24185000-7f1f24186000 rw-p 0004b000 08:12 6815771 /lib/x86_64-linux-gnu/libdbus-1.so.3.14.6
7f1f24186000-7f1f24201000 r-xp 00000000 08:12 2885650 /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so
7f1f24201000-7f1f24401000 ---p 0007b000 08:12 2885650 /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so
7f1f24401000-7f1f24402000 r--p 0007b000 08:12 2885650 /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so
7f1f24402000-7f1f24403000 rw-p 0007c000 08:12 2885650 /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-8.0.so
7f1f24403000-7f1f2440a000 r-xp 00000000 08:12 6823310 /lib/x86_64-linux-gnu/librt-2.23.so
7f1f2440a000-7f1f24609000 ---p 00007000 08:12 6823310 /lib/x86_64-linux-gnu/librt-2.23.so
7f1f24609000-7f1f2460a000 r--p 00006000 08:12 6823310 /lib/x86_64-linux-gnu/librt-2.23.so
7f1f2460a000-7f1f2460b000 rw-p 00007000 08:12 6823310 /lib/x86_64-linux-gnu/librt-2.23.so
7f1f2460b000-7f1f24664000 r-xp 00000000 08:12 2630508 /usr/lib/x86_64-linux-gnu/libwebp.so.5.0.4
7f1f24664000-7f1f24864000 ---p 00059000 08:12 2630508 /usr/lib/x86_64-linux-gnu/libwebp.so.5.0.4
7f1f24864000-7f1f24865000 r--p 00059000 08:12 2630508 /usr/lib/x86_64-linux-gnu/libwebp.so.5.0.4
7f1f24865000-7f1f24867000 rw-p 0005a000 08:12 2630508 /usr/lib/x86_64-linux-gnu/libwebp.so.5.0.4
7f1f24867000-7f1f248d8000 r-xp 00000000 08:12 2642197 /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
7f1f248d8000-7f1f24ad8000 ---p 00071000 08:12 2642197 /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
7f1f24ad8000-7f1f24ad9000 r--p 00071000 08:12 2642197 /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
7f1f24ad9000-7f1f24adc000 rw-p 00072000 08:12 2642197 /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
7f1f24adc000-7f1f24b33000 r-xp 00000000 08:12 2621937 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f1f24b33000-7f1f24d33000 ---p 00057000 08:12 2621937 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f1f24d33000-7f1f24d34000 r--p 00057000 08:12 2621937 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f1f24d34000-7f1f24d35000 rw-p 00058000 08:12 2621937 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f1f24d35000-7f1f24d59000 r-xp 00000000 08:12 6820750 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f1f24d59000-7f1f24f58000 ---p 00024000 08:12 6820750 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f1f24f58000-7f1f24f59000 r--p 00023000 08:12 6820750 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f1f24f59000-7f1f24f5a000 rw-p 00024000 08:12 6820750 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
7f1f24f5a000-7f1f25021000 r-xp 00000000 08:12 2629365 /usr/lib/x86_64-linux-gnu/libcaca.so.0.99.19
7f1f25021000-7f1f25220000 ---p 000c7000 08:12 2629365 /usr/lib/x86_64-linux-gnu/libcaca.so.0.99.19
7f1f25220000-7f1f25221000 r--p 000c6000 08:12 2629365 /usr/lib/x86_64-linux-gnu/libcaca.so.0.99.19
7f1f25221000-7f1f25222000 rw-p 000c7000 08:12 2629365 /usr/lib/x86_64-linux-gnu/libcaca.so.0.99.19
7f1f25222000-7f1f25223000 rw-p 00000000 00:00 0
7f1f25223000-7f1f25234000 r-xp 00000000 08:12 2629210 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f1f25234000-7f1f25433000 ---p 00011000 08:12 2629210 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f1f25433000-7f1f25434000 r--p 00010000 08:12 2629210 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f1f25434000-7f1f25435000 rw-p 00011000 08:12 2629210 /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
7f1f25435000-7f1f2556a000 r-xp 00000000 08:12 2624362 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1f2556a000-7f1f2576a000 ---p 00135000 08:12 2624362 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1f2576a000-7f1f2576b000 r--p 00135000 08:12 2624362 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1f2576b000-7f1f2576f000 rw-p 00136000 08:12 2624362 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
7f1f2576f000-7f1f257bd000 r-xp 00000000 08:12 2622371 /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0
7f1f257bd000-7f1f259bd000 ---p 0004e000 08:12 2622371 /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0
7f1f259bd000-7f1f259be000 r--p 0004e000 08:12 2622371 /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0
7f1f259be000-7f1f259bf000 rw-p 0004f000 08:12 2622371 /usr/lib/x86_64-linux-gnu/libpulse.so.0.19.0
7f1f259bf000-7f1f259c2000 r-xp 00000000 08:12 2622370 /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0.1.0
7f1f259c2000-7f1f25bc2000 ---p 00003000 08:12 2622370 /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0.1.0
7f1f25bc2000-7f1f25bc3000 r--p 00003000 08:12 2622370 /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0.1.0
7f1f25bc3000-7f1f25bc4000 rw-p 00004000 08:12 2622370 /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0.1.0
7f1f25bc4000-7f1f25bc7000 r-xp 00000000 08:12 6823251 /lib/x86_64-linux-gnu/libdl-2.23.so
7f1f25bc7000-7f1f25dc6000 ---p 00003000 08:12 6823251 /lib/x86_64-linux-gnu/libdl-2.23.so
7f1f25dc6000-7f1f25dc7000 r--p 00002000 08:12 6823251 /lib/x86_64-linux-gnu/libdl-2.23.so
7f1f25dc7000-7f1f25dc8000 rw-p 00003000 08:12 6823251 /lib/x86_64-linux-gnu/libdl-2.23.so
7f1f25dc8000-7f1f25ec1000 r-xp 00000000 08:12 2629285 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7f1f25ec1000-7f1f260c0000 ---p 000f9000 08:12 2629285 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0
7f1f260c0000-7f1f260c7000 r--p 000f8000 08:12 2629285 /usr/lib/x86_64-linux-gnu/libasound.so.2.0.0

请问下这个库怎么使用?

我把它clone我的项目,在ubuntu下想直接使用,刚开始报的错误是msgpack.hpp: No such file or directory,然后sudo apt install libmsgpack-dev后,报的错误为
/rest_rpc/include/rest_rpc/codec.h:38:42: error: no matching function for call to ‘unpack(msgpack::v1::unpacked*, const char*&, size_t&)’
38 | msgpack::unpack(&msg_, data, length);
| ^

Little error in sample codes....

First.... thank you for your great/simple rpc lib.

The following codes in examples\app_client\client.hpp has error, right?
Maybe ... client_.async_call<FUTURE>("add", a,b) ?

std::future<req_result> async_add(int a, int b) {
	return client_.async_call("add", a, b);
}

data is packed... when subscript(... [](string_view data)

On examples/client/main.cpp....

client.subscribe("key", [](string_view data) {
std::cout << csprintf("%d.%d ", gettid(), LINE).c_str() << "key= " << &data[1] << "\n";
std::cout << "what is first char of string_view is " << (int)data[0] << std::endl;
});

the data is packed....

so I've changed callback_sub in rpc_client.cpp.
Is it right? thank you...

	void callback_sub(const boost::system::error_code& ec, string_view result) {
		....
			//it->second(data);
			rpc_service::msgpack_codec codec2;
			auto str = codec2.unpack<std::string>(data.data(), data.size());
			it->second(str);
                     ....
	}

client connect()会神秘的返回true (server端就根本没启动)

libtest.cpp如下

#include "thread"
#include "iostream"
#include "chrono"
#include "rpc_client.hpp"

using namespace rest_rpc;
using namespace rest_rpc::rpc_service;

bool online {};

bool init()
{
std::thread check_thread([] () {
rpc_client check_client("127.0.0.1", 3000);

	while (true) {
		auto current_status = check_client.connect();
		check_client.close();
		std::cout << "check server ..." << std::endl;

		if (current_status == online) {
			// do nothing
		} else {
			online = current_status;
			if (!current_status) {
				std::cout << "server is offline" << std::endl;
			} else {
				std::cout << "server is online ..." << std::endl;
			}				
		}

		std::this_thread::sleep_for(std::chrono::seconds(5));
	}
});
check_thread.detach();

return true;

}

build libtest.cpp to shared library (.so file)

g++ -fPIC -shared -o libtest.so libtest.cpp -I./rest_rpc/include -I./rest_rpc/third/msgpack/include -Ipthread

test-1.cpp如下

#include "thread"
#include "iostream"

bool init();

int main()
{
init();

while (true) {
	std::this_thread::sleep_for(std::chrono::seconds(5));
}

// ...	
std::cout << __LINE__ << std::endl;
	
return 0;

}

链接libtest.so生成可执行文件

g++ -o test-1 test-1.cpp -std=c++11 -I./rest_rpc/include -I./rest_rpc/third/msgpack/include -lpthread -ltest -L.

下面是运行test-1的片段

$ ./test-1
check server ...
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
check server ...
server is online ...
check server ...
server is offline
check server ...

这里server (port 3000)就根本没有启动,但test-1在运行时会时不时的变现connect()会返回true,而且概率还蛮高的。

编译时msgpack报大量错误

C++新手,rest_rpc适用于windows么?

配置了第三方 (non-Boost) Asio、msgpack附加包含,编译时(Visual Studio 2019 (v142)、Debug、Win32)msgpack报大量错误,是配置原因么,毫无头绪,请各位大大指教。
错误信息下载

如何支持vector<person>

在通信过程中,想要使用一个自定义类型的数组,请问如何支持。除了vector也可以使用指针类型。

Cannot compile http_epoll.cpp

➜  examples++ git:(master) ✗ ls
a.out                  echo_client_conn.cpp   framing.cpp  http_epoll.cpp  server.cpp              unix_dgram_client.cpp        unix_server_stream.cpp
client.cpp             echo_client_sndto.cpp  http_2.cpp   libsocket++.a   test.sh                 unix_dgram_server.cpp
dgram_over_stream.cpp  echo_server.cpp        http.cpp     libsocket++.so  unix_client_stream.cpp  unix_dgram_syslogclient.cpp
➜  examples++ git:(master) ✗ g++ http_epoll.cpp -std=c++17 -lsocket++
In file included from http_epoll.cpp:3:
../headers/epoll.hpp: In destructor ‘libsocket::epollset<SocketT>::~epollset()’:
../headers/epoll.hpp:127:5: error: there are no arguments to ‘close’ that depend on a template parameter, so a declaration of ‘close’ must be available [-fpermissive]
  127 |     close(epollfd);
      |     ^~~~~
../headers/epoll.hpp:127:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
http_epoll.cpp: In function ‘int main()’:
http_epoll.cpp:35:36: error: use of deleted function ‘libsocket::inet_stream& libsocket::inet_stream::operator=(const libsocket::inet_stream&)’
   35 |             sock = *(ready.first[0]);
      |                                    ^
In file included from http_epoll.cpp:5:
../headers/inetclientstream.hpp:54:7: note: ‘libsocket::inet_stream& libsocket::inet_stream::operator=(const libsocket::inet_stream&)’ is implicitly deleted because the default definition would be ill-formed:
   54 | class inet_stream : public inet_socket, public stream_client_socket {
      |       ^~~~~~~~~~~
../headers/inetclientstream.hpp:54:7: error: use of deleted function ‘libsocket::inet_socket& libsocket::inet_socket::operator=(const libsocket::inet_socket&)’
In file included from ../headers/inetclientstream.hpp:8,
                 from http_epoll.cpp:5:
../headers/inetbase.hpp:52:7: note: ‘libsocket::inet_socket& libsocket::inet_socket::operator=(const libsocket::inet_socket&)’ is implicitly deleted because the default definition would be ill-formed:
   52 | class inet_socket : public virtual socket {
      |       ^~~~~~~~~~~
../headers/inetbase.hpp:52:7: error: use of deleted function ‘constexpr libsocket::socket& libsocket::socket::operator=(const libsocket::socket&)’
In file included from ../headers/epoll.hpp:45,
                 from http_epoll.cpp:3:
../headers/socket.hpp:71:7: note: ‘constexpr libsocket::socket& libsocket::socket::operator=(const libsocket::socket&)’ is implicitly declared as deleted because ‘libsocket::socket’ declares a move constructor or move assignment operator
   71 | class socket {
      |       ^~~~~~
In file included from http_epoll.cpp:5:
../headers/inetclientstream.hpp:54:7: error: use of deleted function ‘libsocket::stream_client_socket& libsocket::stream_client_socket::operator=(const libsocket::stream_client_socket&)’
   54 | class inet_stream : public inet_socket, public stream_client_socket {
      |       ^~~~~~~~~~~
In file included from ../headers/inetclientstream.hpp:9,
                 from http_epoll.cpp:5:
../headers/streamclient.hpp:52:7: note: ‘libsocket::stream_client_socket& libsocket::stream_client_socket::operator=(const libsocket::stream_client_socket&)’ is implicitly declared as deleted because ‘libsocket::stream_client_socket’ declares a move constructor or move assignment operator
   52 | class stream_client_socket : public virtual socket {
      |       ^~~~~~~~~~~~~~~~~~~~
In file included from http_epoll.cpp:3:
../headers/epoll.hpp: In instantiation of ‘libsocket::epollset<SocketT>::~epollset() [with SocketT = libsocket::inet_stream]’:
http_epoll.cpp:23:31:   required from here
../headers/epoll.hpp:127:10: error: ‘close’ was not declared in this scope; did you mean ‘pclose’?
  127 |     close(epollfd);
      |     ~~~~~^~~~~~~~~
      |     pclose
➜  examples++ git:(master) ✗ 

ubuntu上配置

在ubuntu16.04的环境中使用cmake编译example的程序,在编译之前安装了boost。想请教一下,是不是只需要安装boost就可以了。但是在example 下执行cmake 出现了如下的错误:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.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
-- Found Boost: /usr/include (found version "1.58.0") found components: system filesystem
CMake Error at /usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/local/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.20/Modules/FindJNI.cmake:382 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:14 (find_package)

gcc version 5.4.0
boost 1.58.0

server 如何优雅的退出?

我用的平台是 Windows,编译器使用的是 MSVC 2015,并且将该程序嵌入到了 QT 的程序中。并且我的程序被编译成了后台程序,没办法接收信号量。在这种情况下,如何优雅地退出服务器呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.