polarismesh / polaris-cpp Goto Github PK
View Code? Open in Web Editor NEWLightweight C++ SDK used as Proxyless Service Governance
License: Other
Lightweight C++ SDK used as Proxyless Service Governance
License: Other
polaris\cache/rcu_time.h(17): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory
预期希望支持的能力
polaris/logger.cpp:25:10: fatal error: 'syscall.h' file not found
1、执行make
2、报错如下
polaris/plugin/load_balancer/locality_aware/locality_aware.cpp: In member function ‘virtual polaris::ReturnCode polaris::LocalityAwareLoadBalancer::ChooseInstance(polaris::ServiceInstances*, const polaris::Criteria&, polaris::Instance*&)’: polaris/logger.h:39:78: error: format not a string literal and no format arguments [-Werror=format-security] 39 | #define POLARIS_LOG(LOG_LEVEL, ...) GetLogger()->Log(LOG_LEVEL, ##__VA_ARGS__) | ^ polaris/plugin/load_balancer/locality_aware/locality_aware.cpp:192:7: note: in expansion of macro ‘POLARIS_LOG’ 192 | POLARIS_LOG(LOG_INFO, la_info.c_str()); | ^~~~~~~~~~~ cc1plus: all warnings being treated as errors make: *** [Makefile:231:build64/objs/plugin/load_balancer/locality_aware/locality_aware.o] 错误 1
1、在 https://github.com/polarismesh/specification 项目中支持发布 c++ 相关的 protobuf 文件
2、将代码内部的相关 pb 文件全部从 specification 中引入
我们创建了多个ProviderApi来将实例注册到多个不同的名字服务上。但在运行中,会随机出现core在心跳时解析host上。
看到TryLookup 中使用了非线程安全的inet_ntoa。为什么不适用线程安全的inet_ntop了?
std::string target_address = inet_ntoa(*(struct in_addr*)host->h_addr_list[0]);
(gdb) bt
#0 0x0000000001e08b8c in polaris::grpc::TryLookup (address=...) at polaris/network/grpc/http2.cpp:425
#1 polaris::grpc::Http2Client::ConnectTo(std::string const&, int) () at polaris/network/grpc/http2.cpp:455
#2 0x0000000001dbbe54 in polaris::grpc::GrpcClient::ConnectTo (port=, host=..., this=0x7fa36a607c80) at polaris/network/grpc/client.h:192
#3 polaris::BlockRequest::PrepareClient() () at polaris/plugin/server_connector/grpc_server_connector.cpp:972
#4 0x0000000001dbcdde in polaris::GrpcServerConnector::InstanceHeartbeat (this=, req=..., timeout_ms=)
at polaris/plugin/server_connector/grpc_server_connector.cpp:762
#5 0x0000000001e0367b in polaris::ProviderApi::Heartbeat(polaris::InstanceHeartbeatRequest const&) () at polaris/provider/api.cpp:196
#6 0x0000000001d84e90 in gxl_utils::PolarisWrapper::KeepHealth() () at gxl-utils/polaris/polaris_wrapper.cc:199
#7 0x00000000020f65af in execute_native_thread_routine ()
#8 0x00007fc0de8e2e65 in ?? ()
#9 0x0000000000000000 in ?? ()
1、参考PR:polarismesh/polaris-java#192
2、参考设计:polarismesh/polaris#429
修改provider demo,启动多个provider时,指定注册实例id需要保证唯一
What is the feature you want to add?
sdk can use the inputed server address to do all operations, no need to relay on the polaris.discover and polaris.healthcheck
Why do you want to add this feature?
when user use sdk with the standalone server, it won't register the polaris.discover and polaris.healthcheck
How to implement this feature?
in sdk side, when user not input the service address, it won't connect to the service
Additional context
Add any other context or screenshots about the feature request here.
c++ sdk版本:1.1.2
服务端版本:1.13
北极星节点连接拓扑: c++ sdk -> vip ->后端北极星服务
问题产生过程:发布北极星服务端时,重启了一批节点,更换了一些节点ip。客户端此时发送core dump。
客户端报错信息:
warning: Ignoring non-absolute filename: <./lib64_release/libiomp5.so>
Missing separate debuginfo for ./lib64_release/libiomp5.so
Try: yum --enablerepo='debug' install /usr/lib/debug/.build-id/9d/fa23ad70f3f8f50699aac84586f3ba832b7034.debug
Core was generated by `bin/recall_server --flagfile=conf/theme.gflags'.
Program terminated with signal 11, Segmentation fault.
#0 _M_get (this=) at thirdparty/polaris-cpp/polaris/model/instance.cpp:43
43 thirdparty/polaris-cpp/polaris/model/instance.cpp: No such file or directory.
Missing separate debuginfos, use: debuginfo-install blas-3.4.2-8.el7.x86_64 glibc-2.17-292.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_7.2.x86_64 lapack-3.4.2-8.el7.x86_64 libcom_err-1.42.9-16.el7.x86_64 libgcc-4.8.5-39.el7.x86_64 libgfortran-4.8.5-39.el7.x86_64 libgomp-4.8.5-39.el7.x86_64 libquadmath-4.8.5-39.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 libstdc++-4.8.5-36.el7.x86_64 pcre-8.32-17.el7.x86_64
(gdb) bt
#0 _M_get (this=) at thirdparty/polaris-cpp/polaris/model/instance.cpp:43
#1 operator-> (this=) at /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/shared_ptr_base.h:1013
#2 polaris::Instance::GetPort (this=0x0) at thirdparty/polaris-cpp/polaris/model/instance.cpp:43
#3 0x00000000007eb727 in polaris::BlockRequest::OnFailure(std::string const&) ()
at thirdparty/polaris-cpp/polaris/plugin/server_connector/grpc_server_connector.cpp:937
#4 0x00000000007b6b54 in polaris::grpc::Http2Client::ResetAllStream (this=this@entry=0x7f9ba9f0e100,
status=status@entry=polaris::grpc::kGrpcStatusAborted, message="read from socket fd failed")
at thirdparty/polaris-cpp/polaris/network/grpc/http2.cpp:934
#5 0x00000000007b76dd in polaris::grpc::Http2Client::ReadHandler() () at thirdparty/polaris-cpp/polaris/network/grpc/http2.cpp:654
#6 0x000000000078978c in polaris::Reactor::RunEpollTask (this=this@entry=0x7fa780a0bd40, timeout=)
at thirdparty/polaris-cpp/polaris/reactor/reactor.cpp:180
#7 0x0000000000789973 in polaris::Reactor::Run (this=this@entry=0x7fa780a0bd40) at thirdparty/polaris-cpp/polaris/reactor/reactor.cpp:207
#8 0x00000000007edd7a in polaris::GrpcServerConnector::ThreadFunction (arg=0x7fa780a0bd00)
at thirdparty/polaris-cpp/polaris/plugin/server_connector/grpc_server_connector.cpp:250
#9 0x00007fa7ce674e65 in start_thread () from /lib64/libpthread.so.0
#10 0x00007fa7832d688d in clone () from /lib64/libc.so.6
consumer: listen http port, accept http message , then getoneinstance to get an address, send message to provider, after message received, updateservicecallresult
provider:listen to TCP/HTTP port,register instance on startup, and do heartbeat by interval, and deregister when quit signal received.
1、参考PR:polarismesh/polaris-java#218
2、针对 ConsumerAPI 的 GetInstances、GetOneInstance 入参数信息 新增 Argument 参数列表,支持构造对应流量标签的请求参数
3、针对 LimitAPI 的 GetQuota 入参信息,新增 Argument 参数列表,支持构造对应的流量标签请求参数
4、调整 RuleRoute 以及限流中的标签匹配计算,支持 EQUALS/NOT_EQUALS/IN/NOT_IN/REGEX 五种匹配规则
What is the feature you want to add?
sdk discover polaris.discover, polaris.healthcheck, polaris.monitor, should not rely on route-rule
Why do you want to add this feature?
user install standalone version, he won't add the routerule to service
How to implement this feature?
use metadata routing instead of rulebase routing
Additional context
Add any other context or screenshots about the feature request here.
当负载均衡为kLoadBalanceTypeSimpleHash时,GetOneInstanceRequest中设置SetHashString不生效,需要设置SetHashKey才能正常计算节点信息
运行 examples/provider/echo_server 会出现 segmentation fault
./build64/examples/provider/echo_provider default echo token 127.0.0.1 8111
堆栈信息如下:
43 int Instance::GetPort() const { return impl_->remote_value_->port_; }
Missing separate debuginfos, use: debuginfo-install bash-4.2.46-34.tl2.3.x86_64 glibc-2.17-323.tl2.x86_64 libgcc-4.8.5-44.tl2.1.x86_64 libstdc++-4.8.5-44.tl2.1.x86_64 zlib-1.2.7-20.tl2.x86_64
(gdb) bt
#0 polaris::Instance::GetPort (this=0x0) at polaris/model/instance.cpp:43
#1 0x000000000048c06e in polaris::BlockRequest::OnSuccess (this=0xadf2b0, response=0x7ffff000a140) at polaris/plugin/server_connector/grpc_server_connector.cpp:921
#2 0x0000000000491355 in polaris::grpc::RequestCallbackv1::Response::OnResponse (this=0xadf2b0, response=0x7ffff000a080) at polaris/network/grpc/client.h:67
#3 0x000000000046c83e in polaris::grpc::GrpcRequest::OnReceiveResponse (this=, response=0x7ffff000a080) at polaris/network/grpc/client.cpp:164
#4 0x000000000046cced in polaris::grpc::GrpcStream::OnData (this=0x7ffff0008260, data=..., end_stream=) at polaris/network/grpc/client.cpp:120
#5 0x000000000046fe8c in polaris::grpc::Http2Client::OnFrameReceived (this=0xa9c700, frame=0xab0c80) at polaris/network/grpc/http2.cpp:846
#6 0x0000000000501758 in session_call_on_frame_received ()
#7 0x0000000000504663 in nghttp2_session_on_data_received ()
#8 0x00000000005046f9 in session_process_data_frame ()
#9 0x000000000050729f in nghttp2_session_mem_recv ()
#10 0x000000000046f5b4 in polaris::grpc::Http2Client::OnRecvData (this=this@entry=0xa9c700, data=data@entry=0x7ffff5fa6d30) at polaris/network/grpc/http2.cpp:550
#11 0x00000000004709e0 in polaris::grpc::Http2Client::ReadHandler (this=0xa9c700) at polaris/network/grpc/http2.cpp:664
#12 0x0000000000462d51 in polaris::Reactor::RunEpollTask (this=this@entry=0xa99580, timeout=) at polaris/reactor/reactor.cpp:180
#13 0x000000000046318b in polaris::Reactor::Run (this=this@entry=0xa99580) at polaris/reactor/reactor.cpp:207
#14 0x000000000048f302 in polaris::GrpcServerConnector::ThreadFunction (arg=0xa99540) at polaris/plugin/server_connector/grpc_server_connector.cpp:250
#15 0x00007ffff6d82ea5 in start_thread () from /lib64/libpthread.so.0
#16 0x00007ffff6aab9fd in clone () from /lib64/libc.so.6
polaris::GetOneInstanceRequest request 中设置SetCanary 无法正确获取 canary实例信息
目前实例id由服务端自动生成,希望支持实例注册时指定实例id
Windows编译时提示缺少
trpcapi.proto
trpc.proto
dynamicweight.proto
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.