diff --git a/CMakeLists.txt b/CMakeLists.txt index 22ba8494f..8b93d01fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,18 +88,18 @@ if(AIMRT_MASTER_PROJECT) endif() endif() - if(MSVC) - add_compile_options(/utf-8 /wd4819) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") - endif() - - if(WIN32) - add_compile_definitions(NOMINMAX) - endif() - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() +if(MSVC) + add_compile_options(/utf-8 /wd4819) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") +endif() + +if(WIN32) + add_compile_definitions(NOMINMAX) +endif() + # Build document if(AIMRT_BUILD_DOCUMENT) message(STATUS "gen document ...") diff --git a/VERSION b/VERSION index 100435be1..ee94dd834 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.2 +0.8.3 diff --git a/document/sphinx-cn/release_notes/index.md b/document/sphinx-cn/release_notes/index.md index 5ce4057bc..4ca620b47 100644 --- a/document/sphinx-cn/release_notes/index.md +++ b/document/sphinx-cn/release_notes/index.md @@ -8,6 +8,8 @@ v0_8_0.md v0_8_1.md +v0_8_2.md +v0_8_3.md ``` diff --git a/document/sphinx-cn/release_notes/v0_8_2.md b/document/sphinx-cn/release_notes/v0_8_2.md new file mode 100644 index 000000000..e29f490eb --- /dev/null +++ b/document/sphinx-cn/release_notes/v0_8_2.md @@ -0,0 +1,4 @@ +# v0.8.2 + +**重要修改** +- 修复某些平台上与 dl 库的链接问题 \ No newline at end of file diff --git a/document/sphinx-cn/release_notes/v0_8_3.md b/document/sphinx-cn/release_notes/v0_8_3.md new file mode 100644 index 000000000..b80e223e3 --- /dev/null +++ b/document/sphinx-cn/release_notes/v0_8_3.md @@ -0,0 +1,6 @@ +# v0.8.3 + +**重要修改** + +- 修复 aimrt_py 多线程 rpc 调用 server 端概率性崩溃的问题 +- 修复了 windows 下源码引用的构建问题,以及 grpc_plugin 在 windows 下的构建问题 diff --git a/src/plugins/grpc_plugin/CMakeLists.txt b/src/plugins/grpc_plugin/CMakeLists.txt index 8ec94949e..4ac3a3675 100644 --- a/src/plugins/grpc_plugin/CMakeLists.txt +++ b/src/plugins/grpc_plugin/CMakeLists.txt @@ -37,6 +37,11 @@ target_link_libraries( aimrt::runtime::common::net nghttp2::nghttp2) +# Set compile options of target +if(WIN32) + target_compile_definitions(${CUR_TARGET_NAME} PRIVATE ssize_t=long) +endif() + # Add -Werror option include(AddWerror) add_werror(${CUR_TARGET_NAME}) diff --git a/src/plugins/grpc_plugin/grpc/message.h b/src/plugins/grpc_plugin/grpc/message.h index 5d54e0dbe..2667c8e44 100644 --- a/src/plugins/grpc_plugin/grpc/message.h +++ b/src/plugins/grpc_plugin/grpc/message.h @@ -5,6 +5,7 @@ #include #include +#include #include namespace aimrt::plugins::grpc_plugin::grpc { diff --git a/src/runtime/python_runtime/export_channel.h b/src/runtime/python_runtime/export_channel.h index ca63f38db..0d38f321d 100644 --- a/src/runtime/python_runtime/export_channel.h +++ b/src/runtime/python_runtime/export_channel.h @@ -41,8 +41,6 @@ inline void ExportPublisherRef(pybind11::object m) { .def("Publish", &PyPublish); } -inline pybind11::bytes channel_empty_py_bytes; - inline bool PySubscribe( aimrt::channel::SubscriberRef& subscriber_ref, const std::shared_ptr& msg_type_support, @@ -61,17 +59,13 @@ inline bool PySubscribe( const std::string& msg_buf = *static_cast(msg_ptr); auto ctx_ref = aimrt::channel::ContextRef(ctx_ptr); - if (msg_buf.empty()) [[unlikely]] { - callback(ctx_ref.GetSerializationType(), channel_empty_py_bytes); - } else { - auto msg_buf_bytes = pybind11::bytes(msg_buf); + pybind11::gil_scoped_acquire acquire; - callback(ctx_ref.GetSerializationType(), msg_buf_bytes); + auto msg_buf_bytes = pybind11::bytes(msg_buf); + callback(ctx_ref.GetSerializationType(), msg_buf_bytes); + msg_buf_bytes.release(); - pybind11::gil_scoped_acquire acquire; - msg_buf_bytes.release(); - pybind11::gil_scoped_release release; - } + pybind11::gil_scoped_release release; release_callback(); }); diff --git a/src/runtime/python_runtime/export_rpc.h b/src/runtime/python_runtime/export_rpc.h index be7445f5b..068a9a26d 100644 --- a/src/runtime/python_runtime/export_rpc.h +++ b/src/runtime/python_runtime/export_rpc.h @@ -89,8 +89,6 @@ inline void ExportRpcContext(const pybind11::object& m) { .def("ToString", &ContextRef::ToString); } -inline pybind11::bytes rpc_empty_py_bytes; - inline void PyRpcServiceBaseRegisterServiceFunc( aimrt::rpc::ServiceBase& service, std::string_view func_name, @@ -112,29 +110,17 @@ inline void PyRpcServiceBaseRegisterServiceFunc( const std::string& req_buf = *static_cast(req_ptr); std::string& rsp_buf = *static_cast(rsp_ptr); - // TODO,未知原因,在此处使用空字符串构造pybind11::bytes时会挂掉。但是在外面构造没有问题 - if (req_buf.empty()) [[unlikely]] { - auto [status, rsp_buf_tmp] = service_func(ctx_ref, rpc_empty_py_bytes); + pybind11::gil_scoped_acquire acquire; - rsp_buf = std::move(rsp_buf_tmp); + auto req_buf_bytes = pybind11::bytes(req_buf); + auto [status, rsp_buf_tmp] = service_func(ctx_ref, req_buf_bytes); + req_buf_bytes.release(); - callback_f(status.Code()); - return; - } else { - auto req_buf_bytes = pybind11::bytes(req_buf); - - auto [status, rsp_buf_tmp] = service_func(ctx_ref, req_buf_bytes); - - pybind11::gil_scoped_acquire acquire; - req_buf_bytes.release(); - pybind11::gil_scoped_release release; - - rsp_buf = std::move(rsp_buf_tmp); - - callback_f(status.Code()); - return; - } + pybind11::gil_scoped_release release; + rsp_buf = std::move(rsp_buf_tmp); + callback_f(status.Code()); + return; } catch (const std::exception& e) { callback_f(AIMRT_RPC_STATUS_SVR_HANDLE_FAILED); return;