Skip to content

Commit c0a403c

Browse files
authored
Fix Verify in WriteSessionActor (#2651)
1 parent 7c77f08 commit c0a403c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ydb/services/deprecated/persqueue_v0/grpc_pq_write_actor.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ void TWriteSessionActor::SetupCounters(const TString& cloudId, const TString& db
310310

311311

312312
void TWriteSessionActor::Handle(TEvDescribeTopicsResponse::TPtr& ev, const TActorContext& ctx) {
313-
Y_ABORT_UNLESS(State == ES_WAIT_SCHEME || State == ES_INITED);
313+
if (State != ES_WAIT_SCHEME && State != ES_INITED) {
314+
return CloseSession("erroneous internal state", NPersQueue::NErrorCode::ERROR, ctx);
315+
}
316+
314317
auto& res = ev->Get()->Result;
315318
Y_ABORT_UNLESS(res->ResultSet.size() == 1);
316319

@@ -865,7 +868,7 @@ void TWriteSessionActor::LogSession(const TActorContext& ctx) {
865868

866869
void TWriteSessionActor::HandleWakeup(const TActorContext& ctx) {
867870
if (State != ES_INITED) {
868-
return;
871+
return CloseSession("erroneous internal state", NPersQueue::NErrorCode::ERROR, ctx);
869872
}
870873

871874
auto now = ctx.Now();

ydb/services/persqueue_v1/actors/write_session_actor.ipp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,10 @@ void TWriteSessionActor<UseMigrationProtocol>::Handle(TEvents::TEvWakeup::TPtr&
15051505

15061506
template<bool UseMigrationProtocol>
15071507
void TWriteSessionActor<UseMigrationProtocol>::RecheckACL(const TActorContext& ctx) {
1508-
Y_ABORT_UNLESS(State == ES_INITED);
1508+
if (State != ES_INITED) {
1509+
LOG_ERROR_S(ctx, NKikimrServices::PQ_WRITE_PROXY, "WriteSessionActor state is wrong. Actual state '" << (int)State << "'");
1510+
return CloseSession("erroneous internal state", PersQueue::ErrorCode::ERROR, ctx);
1511+
}
15091512

15101513
auto now = ctx.Now();
15111514

0 commit comments

Comments
 (0)