Repository navigation
Interconnecting with the UBShmTransport Based on the LD/ST Shared Memory Semantics. - #3290
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new UBRing-based shared-memory transport mode to brpc (IPC + optional ubs-mem backend) and wires it into the Socket/Transport framework, along with docs and a performance example.
Changes:
- Introduce UBRing transport (
SOCKET_MODE_UBRING) with endpoint handshake, polling, and ring manager infrastructure. - Add shared-memory backend abstraction (POSIX IPC + ubs-mem via dlopen’d SDK stubs/headers) plus timer utilities.
- Update build/docs/examples to expose the feature and provide a basic performance harness.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| src/brpc/ubshm/ubs_mem/ubshmem_stub.cpp | Adds stub implementations of ubs-mem APIs for non-ubs environments/UT. |
| src/brpc/ubshm/ubs_mem/ubs_mem.h | Introduces ubs-mem C API header used by the UBS backend integration. |
| src/brpc/ubshm/ubs_mem/ubs_mem_def.h | Defines ubs-mem types/constants used by the UBS backend integration. |
| src/brpc/ubshm/ubs_mem/declare_shm_ubs.h | Declares the dynamically loaded ubs-mem function pointer table. |
| src/brpc/ubshm/ubr_trx.h | Defines core UBR transaction structures and states. |
| src/brpc/ubshm/ubr_msg.h | Defines UBR message chunk format used by the ring transport. |
| src/brpc/ubshm/ub_ring.h | Declares UBRing read/write and lifecycle APIs used by the endpoint. |
| src/brpc/ubshm/ub_ring_manager.h | Declares global manager for UBR transactions and link bookkeeping. |
| src/brpc/ubshm/ub_ring_manager.cpp | Implements UBR transaction manager and UB event callback plumbing. |
| src/brpc/ubshm/ub_helper.h | Declares UBRing global init/availability helpers. |
| src/brpc/ubshm/ub_helper.cpp | Implements global init/fini, availability flags, and polling init. |
| src/brpc/ubshm/ub_endpoint.h | Declares UB shared-memory endpoint and polling infrastructure. |
| src/brpc/ubshm/ub_endpoint.cpp | Implements handshake, polling loop, and I/O integration with Socket/InputMessenger. |
| src/brpc/ubshm/timer/timer_mgr.h | Declares timer module used by UBS cleanup/recovery flows. |
| src/brpc/ubshm/timer/timer_mgr.cpp | Implements epoll/kqueue-based timer dispatch for UBRing subsystems. |
| src/brpc/ubshm/shm/shm_ubs.h | Declares UBS backend shared-memory operations. |
| src/brpc/ubshm/shm/shm_ubs.cpp | Implements UBS backend via dynamically loaded ubs-mem SDK. |
| src/brpc/ubshm/shm/shm_mgr.h | Declares backend-agnostic SHM manager interface. |
| src/brpc/ubshm/shm/shm_mgr.cpp | Implements SHM manager selecting IPC vs UBS backend via flag. |
| src/brpc/ubshm/shm/shm_ipc.h | Declares POSIX IPC SHM backend operations. |
| src/brpc/ubshm/shm/shm_ipc.cpp | Implements POSIX IPC SHM backend operations. |
| src/brpc/ubshm/shm/shm_def.h | Adds SHM structs/constants used across SHM backends and UBRing. |
| src/brpc/ubshm/common/thread_lock.h | Adds RAII-style mutex/spin/rwlock/semaphore guard macros. |
| src/brpc/ubshm/common/common.h | Adds common macros/types/constants used throughout UBRing code. |
| src/brpc/ubshm_transport.h | Declares UBShmTransport implementing the Transport interface. |
| src/brpc/ubshm_transport.cpp | Implements transport selection between UBRing and TCP fallback paths. |
| src/brpc/transport_factory.cpp | Wires SOCKET_MODE_UBRING into transport creation/context init. |
| src/brpc/socket.h | Adds UB endpoint/connect friend declarations for Socket integration. |
| src/brpc/socket_mode.h | Adds SOCKET_MODE_UBRING enum value. |
| src/brpc/rdma_transport.cpp | Adjusts RDMA transport’s TCP fallback member initialization (currently broken). |
| src/brpc/input_messenger.h | Adds UB endpoint friend declaration to support message processing hooks. |
| src/brpc/input_messenger.cpp | Extends RDMA-special message queuing behavior to UBRing sockets. |
| src/brpc/controller.h | Guards latency_us() against unset begin time. |
| README.md | Adds docs link for UBRing. |
| README_cn.md | Adds docs link for UBRing (CN). |
| example/ubring_performance/test.proto | Adds proto for UBRing performance test example. |
| example/ubring_performance/server.cpp | Adds UBRing-capable perf test server example. |
| example/ubring_performance/client.cpp | Adds UBRing-capable perf test client example. |
| example/ubring_performance/CMakeLists.txt | Adds standalone CMake build for the performance example. |
| docs/en/ubring.md | Documents build/run/configuration and backend selection for UBRing. |
| docs/cn/ubring.md | Chinese documentation for UBRing build/run/configuration. |
| CMakeLists.txt | Adds WITH_UBRING option and compile definition wiring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Another crash: ./ubring_performance_client -use_ubring=true -echo_attachment=true -attachment_size=6291456
I0526 23:17:51.313918 98707 0 /brpc/src/brpc/server.cpp:1232 StartInternal] Server[DummyServerOf(./ubring_performance_client)] is serving on port=8001.
[Threads: 1, Depth: 1, Attachment: 6291456B, UBRING: yes, Echo: yes]
I0526 23:17:51.321939 98707 0 /brpc/src/brpc/ubshm/shm/shm_mgr.cpp:72 ShmMgrInit] shm mgr init success, shm type=1
I0526 23:17:51.332043 98719 0 /brpc/src/brpc/ubshm/ub_ring.cpp:269 UbrTrxHBCallback] Heartbeat cannot be started, wait connected state.
Avg-Latency: 0, 90th-Latency: 0, 99th-Latency: 0, 99.9th-Latency: 0, Throughput: 64.0254MB/s, QPS: 0k, Server CPU-utilization: 0%, Client CPU-utilization: 102%
[Threads: 2, Depth: 1, Attachment: 6291456B, UBRING: yes, Echo: yes]
[1] 98707 bus error (core dumped) ./ubring_performance_client -use_ubring=true -echo_attachment=true./ubring_performance_server -use_ubring=true
I0526 23:17:49.302722 98508 0 /brpc/src/brpc/ubshm/shm/shm_mgr.cpp:72 ShmMgrInit] shm mgr init success, shm type=1
I0526 23:17:49.318155 98508 0 /brpc/src/brpc/server.cpp:1232 StartInternal] Server[test::PerfTestServiceImpl] is serving on port=8002.
W0526 23:18:15.647572 98668 8589934810 /brpc/src/brpc/ubshm/ub_endpoint.cpp:480 ProcessHandshakeAtServer] Fail to read Hello Message from client:brpc::Socket{id=234 fd=11 addr=127.0.0.1:51360:8002} (0x7f2c24025030) 127.0.0.1:51360: Got EOF
I0526 23:18:16.331656 98520 0 /brpc/src/brpc/ubshm/ub_ring.cpp:269 UbrTrxHBCallback] Heartbeat cannot be started, wait connected state.
E0526 23:18:20.648439 98660 8589934772 /brpc/src/brpc/ubshm/common/common.h:173 HasTimedOut] task time out 5 seconds.
W0526 23:18:20.648472 98660 8589934772 /brpc/src/brpc/ubshm/ub_ring.cpp:85 UbrTrxClose] Local shm UBRING_127.0.0.1:36514_S wait for the peer to close timed out, force cleanup.
I0526 23:18:21.332054 98660 8589934772 /brpc/src/brpc/ubshm/shm/shm_ipc.cpp:185 IpcShmRemoteFree] IPC free remote shm=UBRING_127.0.0.1:36514_C success.
I0526 23:18:21.332468 98660 8589934772 /brpc/src/brpc/ubshm/shm/shm_ipc.cpp:78 IpcShmMunmap] IPC unmap shm=UBRING_127.0.0.1:36514_S length=4194304 success.
I0526 23:18:21.332848 98660 8589934772 /brpc/src/brpc/ubshm/shm/shm_ipc.cpp:185 IpcShmRemoteFree] IPC free remote shm=UBRING_127.0.0.1:36514_C success.warning: 228 ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: No such file or directory
[Current thread is 1 (Thread 0x7f7db0ff96c0 (LWP 98717))]
(gdb)
(gdb) bt
#0 __memset_avx512_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:228
#1 0x000055df0fec824b in memset (__len=<optimized out>, __ch=0, __dest=<optimized out>)
at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59
#2 brpc::ubring::ShmLocalCalloc (shm=shm@entry=0x7f7d91af4e00) at /brpc/src/brpc/ubshm/shm/shm_mgr.cpp:117
#3 0x000055df0fea20de in brpc::ubring::UBRing::ApplyAndMapLocalShm (this=this@entry=0x7f7d8c031a00,
localTrxShm=localTrxShm@entry=0x7f7d91af4e00, localName=localName@entry=0x7f7d91af4e50 "127.0.0.1:51360")
at /brpc/src/brpc/ubshm/ub_ring.cpp:911
#4 0x000055df0fea25a2 in brpc::ubring::UBRing::UbrAllocateLocalShm (this=0x7f7d8c031a00,
local_trx_shm=local_trx_shm@entry=0x7f7d91af4e00, shm_name=shm_name@entry=0x7f7d91af4e50 "127.0.0.1:51360")
at /brpc/src/brpc/ubshm/ub_ring.cpp:827
#5 0x000055df0fe9aa35 in brpc::ubring::UBShmEndpoint::AllocateClientResources (this=this@entry=0x55df11984ee0,
local_trx_shm=local_trx_shm@entry=0x7f7d91af4e00, shm_name=shm_name@entry=0x7f7d91af4e50 "127.0.0.1:51360")
at /brpc/src/brpc/ubshm/ub_endpoint.cpp:687
#6 0x000055df0fe9ae6a in brpc::ubring::UBShmEndpoint::ProcessHandshakeAtClient (arg=0x55df11984ee0)
at /brpc/src/brpc/ubshm/ub_endpoint.cpp:356
#7 0x000055df0fc09c97 in bthread::TaskGroup::task_runner (skip_remained=<optimized out>)
at /brpc/src/bthread/task_group.cpp:388
#8 0x000055df0fde1571 in bthread_make_fcontext ()
#9 0x0000000000000000 in ?? () |
Co-authored-by: 郭业昌 <lvpengfei@MacBook-Air.local>
|
@chenBright please try it again, I have add some refine code logical |
|
@zchuango Could you add some unit tests for UBShmTransport? |
Yes, I am writing some test cases for UbShmTransport, planning to submit them to unittest in the next phase. Please help write a review approve for the merge. @chenBright |
I think it's best to submit unit tests in this PR. |
chenBright
left a comment
There was a problem hiding this comment.
I'm using the latest code and I'm encountering the same crash as before.
| int32_t g_epollFd = -1; | ||
| std::atomic<uint32_t> g_totalTimerNum; | ||
| TimerFdCtx *g_timerFdCtxMap = NULL; | ||
| uint32_t maxSystemFd; | ||
| static pthread_t g_epollExecuteThread; | ||
| static int32_t g_timerModuleInitialized; |
There was a problem hiding this comment.
- These variables need to be set with default values.
- The variable name should be snake_case.
| maxSystemFd = (uint32_t)rlim.rlim_cur; | ||
|
|
||
| if (g_timerFdCtxMap == NULL) { | ||
| g_timerFdCtxMap = (TimerFdCtx *)malloc(sizeof(TimerFdCtx) * maxSystemFd); |
There was a problem hiding this comment.
g_timerFdCtxMap may consume a lot of memory.
| return atomic_load(&g_totalTimerNum); | ||
| } | ||
|
|
||
| void CloseTimerFd(uint32_t fd) { |
| #define LIKELY(x) __builtin_expect(!!(x), 1) | ||
| #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
There was a problem hiding this comment.
Use BAIDU_LIKELY and BAIDU_UNLIKELY instead.
| uint8_t inner[UBR_MSG_PAYLOAD_LEN]; | ||
| } UbrMsgPayload; | ||
|
|
||
| typedef struct __attribute__((aligned(64))) TagUbrMsgFormat { |
There was a problem hiding this comment.
Use BAIDU_CACHELINE_ALIGNMENT instead.
| #define LOCK_GUARD(mtxPtr) \ | ||
| pthread_mutex_t *__attribute__((cleanup(UnlockMutex))) _mtxPtr = ({ \ | ||
| pthread_mutex_lock(&(mtxPtr)); \ | ||
| &(mtxPtr); \ | ||
| }) |
There was a problem hiding this comment.
Use BAIDU_SCOPED_LOCK or std::lock_guard insteal.
| #define SPIN_LOCK_GUARD(spinLockPtr) \ | ||
| pthread_spinlock_t *__attribute__((cleanup(UnlockSpinLock))) _spinLockPtr = ({ \ | ||
| pthread_spin_lock(&(spinLockPtr)); \ | ||
| &(spinLockPtr); \ | ||
| }) |
There was a problem hiding this comment.
Use BAIDU_SCOPED_LOCK or std::lock_guard insteal.
| extern "C" { | ||
| #endif | ||
|
|
||
| static inline void UnlockMutex(pthread_mutex_t **mtx) |
There was a problem hiding this comment.
The functions and macros defined in this file are not used; it is recommended to remove them.
|
|
||
| RETURN_CODE UbsShmInit(void) | ||
| { | ||
| // 加载libubsm_sdk.so函数指针 |
| if (UNLIKELY(CheckTrxSendPreCheck(_trx) != UBRING_OK)) { | ||
| return UBRING_ERR; | ||
| } | ||
| // 1.2 计算空间 |
Okay, no problem. I'll add it in the next couple of days. @chenBright |
Really? I haven't encountered this problem on my machine, but it's an ARM machine. I'll try running it on an x86 machine first. |
* 修复ubring server端关闭连接coredump问题 * 修复PollIn/PollOut解引用已释放Socket指针的问题 PollIn/PollOut通过ep->_socket(裸指针)读取data socket,当data socket 被销毁时该指针悬空,导致Socket::Address读到垃圾id触发SIGSEGV。 改为存储_socket_id(SocketId),用Address获取引用计数的Socket, 并在整个回调期间持有该引用,避免解引用悬空指针。 * 修复client非正常退出导致UBRING shm残留的问题 client被强杀(SIGTERM/崩溃/OOM)时teardown没跑完,localShm(_C)的 shm_unlink未执行,导致/dev/shm残留_C文件。server的remoteShm只munmap 不unlink(正确),无法清理client的名字。 在握手ESTABLISHED时(client/server都确认对方已mmap自己的localShm) 立即unlink localShm名字。此时对端已持有mmap引用,unlink只删名字不 影响通信;进程任意时刻退出都不会残留文件名。 * Address chenBright's review: use English comments and BAIDU_CACHELINE_ALIGNMENT - Convert all Chinese comments in ubshm to English (per chenBright's 'Please use English' on ub_endpoint.cpp:723, ub_ring.cpp:337, shm_ubs.cpp:316, and similar) - Replace __attribute__((aligned(64))) with BAIDU_CACHELINE_ALIGNMENT in ubr_msg.h (per chenBright's comment on ubr_msg.h:41) - Remove unnecessary TODO comment in ub_ring.cpp:551 (per chenBright's 'Unnecessary comments, please delete') * Remove unused lock macros in thread_lock.h Per chenBright's review, the functions and macros defined in thread_lock.h are largely unused. Verified usage across ubshm: - LOCK_GUARD / UnlockMutex: 8 call sites in shm_ubs.cpp and ub_ring_manager.cpp, kept. - SPIN_LOCK_GUARD, R_LOCK_GUARD, W_LOCK_GUARD, SEMAPHORE_WAIT_GUARD, SEMAPHORE_WAIT_GUARD_WITH_CLOSE and their helper functions (UnlockSpinLock, UnlockRWLock, PostSem, PostSemWithClose): 0 call sites, removed. * Apply chenBright's review on timer_mgr globals Per chenBright's review on timer_mgr.cpp:32-37: - Add explicit default values to uninitialized globals (g_total_timer_num=0, g_max_system_fd=0, g_epoll_execute_thread=0, g_timer_module_initialized=0) - Rename globals to snake_case (g_epollFd -> g_epoll_fd, g_totalTimerNum -> g_total_timer_num, g_timerFdCtxMap -> g_timer_fd_ctx_map, maxSystemFd -> g_max_system_fd, g_epollExecuteThread -> g_epoll_execute_thread, g_timerModuleInitialized -> g_timer_module_initialized) - maxSystemFd also gains the g_ prefix to match global naming style Also fix the missing std:: qualifier on atomic_fetch_sub/add/load (per chenBright's earlier comment on timer_mgr.cpp:80). * Change CloseTimerFd fd type from uint32_t to int Per chenBright's review on timer_mgr.cpp:399 (uint32_t -> int). fd is a system file descriptor; POSIX APIs use int and -1 denotes an invalid fd, which uint32_t cannot represent. Changed the CloseTimerFd signature (header + definition) and removed the now-unnecessary (uint32_t) casts at the two call sites. * Use BAIDU_LIKELY/BAIDU_UNLIKELY instead of custom __builtin_expect Per chenBright's review on common.h:27. Rather than redefine the macros with __builtin_expect directly, forward LIKELY/UNLIKELY to brpc's standard BAIDU_LIKELY/BAIDU_UNLIKELY (from butil/compiler_specific.h). The 122 call sites keep using LIKELY()/UNLIKELY() unchanged; only the macro bodies change, preserving semantics. * Add unit tests for UBShmEndpoint Per chenBright's request to add unit tests for UBShmTransport in this PR (rather than a follow-up). Adds test/brpc_ubring_unittest.cpp with tests covering the public interface of UBShmEndpoint under the g_skip_ub_init=true mode (which skips real shared-memory/poller setup): - construct_and_destruct: lifecycle safety - is_writable_false_when_skip_init: skip-mode behavior - reset_is_idempotent: Reset() is safe to call repeatedly The file follows the brpc_*_unittest.cpp naming convention so it is auto-collected by test/CMakeLists.txt's file(GLOB). Verified: compiles, links, and all 3 tests pass (g++ 15.2, C++17, gtest, BRPC_WITH_UBRING=ON). * Rewrite UBShmEndpoint unit tests with real coverage Per chenBright's feedback that the previous tests were too simple and did not cover the main methods. Source changes to enable testing: - Move HelloMessage struct declaration from ub_endpoint.cpp to ub_endpoint.h so tests can access it - Expose private members under #ifdef UNIT_TEST (precedent: butil/containers/stack_container.h) so tests can call AllocateClientResources without -Dprivate=public (which breaks GCC 15 + new libstdc++ <any>/<sstream>) Tests (9, all passing on Ubuntu 26.04 g++ 15.2 C++17 gtest): HelloMessageTest (5): serialize/deserialize roundtrip, network byte order verification, uint64 max boundary, full shm_name, toString UBShmEndpointTest (4): construct, real IPC shm AllocateClientResources (g_skip_ub_init=false), reset cleanup, reset idempotency
|
@chenBright I have change the chinese comment and add the ut for ubshmtransport, check it again pls |
./ubring_performance_client -use_ubring=true -echo_attachment=true -attachment_size=6291456
I0712 23:42:12.017195 3264863 0 /workspace/cgm/brpc/src/brpc/server.cpp:1243 StartInternal] Server[DummyServerOf(./ubring_performance_client)] is serving on port=8001.
[Threads: 1, Depth: 1, Attachment: 6291456B, UBRING: yes, Echo: yes]
I0712 23:42:12.026167 3264863 0 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_mgr.cpp:72 ShmMgrInit] shm mgr init success, shm type=1
E0712 23:42:12.026774 3264871 4294968065 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_ipc.cpp:39 ReserveIpcShm] IPC reserve shm=UBRING_127.0.0.1:62484_C length=4194304 failed, ret(28).
E0712 23:42:12.026797 3264871 4294968065 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_mgr.cpp:114 ShmLocalCalloc] Failed to alloc local shm.
E0712 23:42:12.026802 3264871 4294968065 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:926 ApplyAndMapLocalShm] Trx apply local shared memory failed, local shm name=UBRING_127.0.0.1:62484_C, rc=-100
E0712 23:42:12.026807 3264871 4294968065 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:840 UbrAllocateLocalShm] Trx apply or map local shared memory failed, localName=127.0.0.1:62484
W0712 23:42:12.026816 3264871 4294968065 /workspace/cgm/brpc/src/brpc/ubshm/ub_endpoint.cpp:348 ProcessHandshakeAtClient] Fallback to tcp:brpc::Socket{id=1 fd=8 addr=0.0.0.0:8002:62484} (0x5587f03b4f40)
Avg-Latency: 2486, 90th-Latency: 2630, 99th-Latency: 3961, 99.9th-Latency: 4696, Throughput: 2344.77MB/s, QPS: 0k, Server CPU-utilization: 191%, Client CPU-utilization: 179%
E0712 23:42:32.030796 3264873 489626272583 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:1035 UbrTrxCloseCheck] Trx close failed, client trx is null.
[Threads: 2, Depth: 1, Attachment: 6291456B, UBRING: yes, Echo: yes]
E0712 23:42:32.035919 3264871 493921240022 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_ipc.cpp:39 ReserveIpcShm] IPC reserve shm=UBRING_127.0.0.1:52664_C length=4194304 failed, ret(28).
E0712 23:42:32.035941 3264871 493921240022 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_mgr.cpp:114 ShmLocalCalloc] Failed to alloc local shm.
E0712 23:42:32.035947 3264871 493921240022 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:926 ApplyAndMapLocalShm] Trx apply local shared memory failed, local shm name=UBRING_127.0.0.1:52664_C, rc=-100
E0712 23:42:32.035951 3264871 493921240022 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:840 UbrAllocateLocalShm] Trx apply or map local shared memory failed, localName=127.0.0.1:52664
W0712 23:42:32.035958 3264871 493921240022 /workspace/cgm/brpc/src/brpc/ubshm/ub_endpoint.cpp:348 ProcessHandshakeAtClient] Fallback to tcp:brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52664} (0x5587f03b55c0)
W0712 23:42:32.036008 3264863 0 /workspace/cgm/brpc/example/ubring_performance/client.cpp:131 Init] RPC call failed, retrying... (3 left): [E11]Fail to connect brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52664} (0x5587f03b55c0): Resource temporarily unavailable
E0712 23:42:32.136118 3264873 4294970112 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:1035 UbrTrxCloseCheck] Trx close failed, client trx is null.
I0712 23:42:32.136156 3264873 4294970112 /workspace/cgm/brpc/src/brpc/socket.cpp:2570 CheckHealth] Checking Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0)
I0712 23:42:32.136296 3264871 4294970112 /workspace/cgm/brpc/src/brpc/socket.cpp:2630 AfterRevived] Revived Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0) (Connectable)
E0712 23:42:33.036319 3264871 528280980045 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_ipc.cpp:39 ReserveIpcShm] IPC reserve shm=UBRING_127.0.0.1:52674_C length=4194304 failed, ret(28).
E0712 23:42:33.036349 3264871 528280980045 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_mgr.cpp:114 ShmLocalCalloc] Failed to alloc local shm.
E0712 23:42:33.036353 3264871 528280980045 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:926 ApplyAndMapLocalShm] Trx apply local shared memory failed, local shm name=UBRING_127.0.0.1:52674_C, rc=-100
E0712 23:42:33.036356 3264871 528280980045 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:840 UbrAllocateLocalShm] Trx apply or map local shared memory failed, localName=127.0.0.1:52674
W0712 23:42:33.036364 3264871 528280980045 /workspace/cgm/brpc/src/brpc/ubshm/ub_endpoint.cpp:348 ProcessHandshakeAtClient] Fallback to tcp:brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52674} (0x5587f03b55c0)
W0712 23:42:33.036402 3264863 0 /workspace/cgm/brpc/example/ubring_performance/client.cpp:131 Init] RPC call failed, retrying... (2 left): [E115]Fail to connect brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52674} (0x5587f03b55c0): Operation now in progress
E0712 23:42:33.236540 3264873 4294970113 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:1035 UbrTrxCloseCheck] Trx close failed, client trx is null.
I0712 23:42:33.236592 3264873 4294970113 /workspace/cgm/brpc/src/brpc/socket.cpp:2570 CheckHealth] Checking Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0)
I0712 23:42:33.236752 3264871 4294970113 /workspace/cgm/brpc/src/brpc/socket.cpp:2630 AfterRevived] Revived Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0) (Connectable)
E0712 23:42:34.036694 3264871 519691043831 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_ipc.cpp:39 ReserveIpcShm] IPC reserve shm=UBRING_127.0.0.1:52688_C length=4194304 failed, ret(28).
E0712 23:42:34.036725 3264871 519691043831 /workspace/cgm/brpc/src/brpc/ubshm/shm/shm_mgr.cpp:114 ShmLocalCalloc] Failed to alloc local shm.
E0712 23:42:34.036730 3264871 519691043831 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:926 ApplyAndMapLocalShm] Trx apply local shared memory failed, local shm name=UBRING_127.0.0.1:52688_C, rc=-100
E0712 23:42:34.036733 3264871 519691043831 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:840 UbrAllocateLocalShm] Trx apply or map local shared memory failed, localName=127.0.0.1:52688
W0712 23:42:34.036741 3264871 519691043831 /workspace/cgm/brpc/src/brpc/ubshm/ub_endpoint.cpp:348 ProcessHandshakeAtClient] Fallback to tcp:brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52688} (0x5587f03b55c0)
W0712 23:42:34.036777 3264863 0 /workspace/cgm/brpc/example/ubring_performance/client.cpp:131 Init] RPC call failed, retrying... (1 left): [E115]Fail to connect brpc::Socket{id=3 fd=8 addr=0.0.0.0:8002:52688} (0x5587f03b55c0): Operation now in progress
E0712 23:42:34.436931 3264873 4294970114 /workspace/cgm/brpc/src/brpc/ubshm/ub_ring.cpp:1035 UbrTrxCloseCheck] Trx close failed, client trx is null.
I0712 23:42:34.436981 3264873 4294970114 /workspace/cgm/brpc/src/brpc/socket.cpp:2570 CheckHealth] Checking Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0)
I0712 23:42:34.437151 3264871 4294970114 /workspace/cgm/brpc/src/brpc/socket.cpp:2630 AfterRevived] Revived Socket{id=3 addr=0.0.0.0:8002} (0x5587f03b55c0) (Connectable)
E0712 23:42:35.036864 3264863 0 /workspace/cgm/brpc/example/ubring_performance/client.cpp:135 Init] RPC call failed after multiple retriesI failed to run the ubring example with the latest code; see the log above for details. @zchuango |
| } | ||
|
|
||
| #if defined(OS_LINUX) | ||
| int32_t readyNum = epoll_wait(g_epoll_fd, readyEvents, MAX_TIMER, |
There was a problem hiding this comment.
Please update the variable naming to follow the snake_case style used in this codebase. For example, readyNum should be renamed to ready_num. Please apply the same naming convention to other variables as well.
@chenBright Hello chenBright,The code reports ret(28) = errno 28 = ENOSPC (No space left on device). |
# Conflicts: # CMakeLists.txt
|
@chenBright I have update the variable naming to follow the snake_case style. please check it again, looking forward to merging it into the main branch. |
The reason why there're residual shm files is that current implement has bug in timer_mgr.cpp and suffers from memory leak... I will create an issue later. @chenBright |
What problem does this PR solve?
Issue Number: #3226 #3167 #3217
Problem Summary:
After recent efforts, the UB-Ring framework has been successfully integrated with the BRPC transport framework. Currently, high-performance and low-latency communication based on the load/store (LD/ST) semantics is supported. I feel happy be able to contribute this to the community and look forward to receiving feedback and reviews. @wwbmmm @chenBright
What is changed and the side effects?
Changed:
Side effects:
Performance effects: NAN
Breaking backward compatibility:
Check List: