aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2022-09-19 19:17:30 +0300
committershmel1k <shmel1k@ydb.tech>2022-09-19 19:17:30 +0300
commit2e63107dc1d53825b8b603102e941c9b2753b26f (patch)
tree85075e5a2fc6e007def69342f7dc21775e5b2b1d
parent395a2291be2723cca13ef5810204e7d378fc1787 (diff)
downloadydb-2e63107dc1d53825b8b603102e941c9b2753b26f.tar.gz
[] fixed CPU usage in stuck if SessionClosed received as the
first and only event
-rw-r--r--ydb/public/lib/ydb_cli/topic/topic_write.cpp5
-rw-r--r--ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/ydb/public/lib/ydb_cli/topic/topic_write.cpp b/ydb/public/lib/ydb_cli/topic/topic_write.cpp
index 6b7aee03af7..49496d724cc 100644
--- a/ydb/public/lib/ydb_cli/topic/topic_write.cpp
+++ b/ydb/public/lib/ydb_cli/topic/topic_write.cpp
@@ -83,6 +83,11 @@ namespace NYdb::NConsoleClient {
if (!initSeqNo.HasValue()) {
// TODO(shmel1k@): logging
if (initSeqNo.HasException()) {
+ // NOTE(shmel1k@): SessionClosedEvent is stored in EventsQueue, so we can try to get it.
+ auto event = WriteSession_->GetEvent(true);
+ if (event.Defined()) {
+ return HandleEvent(*event);
+ }
initSeqNo.TryRethrow();
}
return EXIT_FAILURE;
diff --git a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.h b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.h
index a51db566eae..8425e2ed937 100644
--- a/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.h
+++ b/ydb/public/sdk/cpp/client/ydb_persqueue_core/impl/read_session.h
@@ -765,7 +765,7 @@ public:
break;
}
}
- } while (block && (eventInfos.empty() || eventInfos.back().IsSessionClosedEvent()));
+ } while (block && eventInfos.empty());
ApplyCallbacksToReadyEventsImpl(deferred);
}