Skip to content

Commit d4337e3

Browse files
authored
[coro_io][ibverbs] fix error handle of fd falsely wake up (#1024)
1 parent 9a32bc5 commit d4337e3

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

include/ylt/coro_io/ibverbs/ib_socket.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,17 +271,21 @@ struct ib_socket_shared_state_t
271271
int r = ibv_get_cq_event(channel_.get(), &cq, &ev_ctx);
272272
// assert(r >= 0);
273273
std::error_code ec;
274-
if (r) {
275-
ELOG_INFO << "there isn't any Completion event to read";
276-
return std::make_error_code(std::errc{std::errc::io_error});
274+
if (r) [[unlikely]] {
275+
ELOG_WARN << "there isn't any Completion event to read, errno" << errno;
276+
if (errno != EAGAIN && errno != EWOULDBLOCK) [[unlikely]] {
277+
ELOG_WARN << "failed to get comp_channel event";
278+
return std::make_error_code(std::errc{std::errc::io_error});
279+
}
280+
return {};
277281
}
278282
ibv_ack_cq_events(cq, 1);
279283
r = ibv_req_notify_cq(cq, 0);
280-
if (r) {
284+
if (r) [[unlikely]] {
281285
ELOG_ERROR << std::make_error_code(std::errc{r}).message();
282286
return std::make_error_code(std::errc{r});
283287
}
284-
struct ibv_wc wc{};
288+
struct ibv_wc wc {};
285289
int ne = 0;
286290
std::vector<resume_struct> vec;
287291
callback_t tmp_recv_callback;

include/ylt/coro_rpc/impl/coro_rpc_client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,8 @@ class coro_rpc_client {
12701270
co_return rpc_error{errc::timed_out};
12711271
}
12721272
else {
1273+
ELOG_ERROR << "write error: " << ret.first.value() << ", "
1274+
<< ret.first.message();
12731275
co_return rpc_error{errc::io_error, ret.first.message()};
12741276
}
12751277
}

include/ylt/version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
// YLT_VERSION % 100 is the sub-minor version
2121
// YLT_VERSION / 100 % 1000 is the minor version
2222
// YLT_VERSION / 100000 is the major version
23-
#define YLT_VERSION 501 // 0.5.1
23+
#define YLT_VERSION 503 // 0.5.3

src/coro_rpc/benchmark/bench.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ async_simple::coro::Lazy<void> watcher(const bench_config& conf) {
109109
break;
110110
}
111111
auto thp = g_throughput_count.exchange(0);
112+
if (thp == 0) {
113+
continue;
114+
}
112115
total += thp;
113116
auto qps = g_qps_count.exchange(0);
114117
total_qps += qps;

0 commit comments

Comments
 (0)