Skip to content

Commit

Permalink
Prevent "div by 0" during PickSessionToShutdown routine (ydb-platform…
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherednik authored and naspirato committed May 15, 2024
1 parent b1bc764 commit e63d6fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ydb/core/kqp/proxy_service/kqp_proxy_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class TLocalSessionsRegistry {

TKqpSessionInfo* PickSessionToShutdown(bool force, ui32 minReasonableToKick) {
auto& sessions = force ? ReadySessions.at(0) : ReadySessions.at(1);
if (sessions.size() >= minReasonableToKick) {
if (!sessions.empty() && sessions.size() >= minReasonableToKick) {
ui64 idx = RandomProvider->GenRand() % sessions.size();
return StartShutdownSession(sessions[idx]);
}
Expand Down

0 comments on commit e63d6fe

Please sign in to comment.