Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/brpc/urma/urma_endpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ int UrmaEndpoint::PollingModeInitialize(

void UrmaEndpoint::PollingModeRelease(bthread_tag_t tag) {
auto& poller_groups = PollerGroups();
if (!FLAGS_urma_use_polling || tag >= poller_groups.size()) {
if (tag >= poller_groups.size()) {
return;
}
auto& group = poller_groups[tag];
Expand Down
6 changes: 4 additions & 2 deletions src/brpc/urma/urma_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,10 @@ static bool GlobalUrmaInitializeImpl() {
return false;
}

if (FLAGS_urma_use_polling) {
atexit(ReleasePollingModeAtExit);
if (FLAGS_urma_use_polling &&
atexit(ReleasePollingModeAtExit) != 0) {
LOG(ERROR) << "Fail to register URMA polling shutdown handler";
return false;
}

g_urma_available.store(true, butil::memory_order_release);
Expand Down
2 changes: 2 additions & 0 deletions test/brpc_urma_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ TEST(UrmaPollingDeathTest, global_shutdown_joins_all_tags) {
[] { ++g_exit_pollers_released; }) != 0) {
std::_Exit(92);
}
urma::FLAGS_urma_use_polling = false;
urma::UrmaEndpoint::GlobalPollingModeRelease();
urma::UrmaEndpoint::GlobalPollingModeRelease();
if (g_exit_pollers_released.load() != 4) {
Expand Down Expand Up @@ -191,6 +192,7 @@ TEST(UrmaPollingDeathTest, exit_stops_pollers_before_late_endpoint_cleanup) {
g_exit_endpoint = new urma::UrmaEndpoint(nullptr);
g_exit_endpoint->_resource = new urma::UrmaResource;
g_exit_endpoint->_cq_sid = 7;
urma::FLAGS_urma_use_polling = false;
std::exit(0);
}, ::testing::ExitedWithCode(0), "");
}
Expand Down
Loading