diff options
author | Semyon Danilov <senya@ydb.tech> | 2024-01-29 18:01:24 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 18:01:24 +0400 |
commit | a24a53f800f83866fdf37c6d504e8302dc2aa1be (patch) | |
tree | 51a3472f0b7479fc9d15425ae471c8d98307baf7 | |
parent | f5290a799aa007d25596748b6bbabe2d2399dda1 (diff) | |
download | ydb-a24a53f800f83866fdf37c6d504e8302dc2aa1be.tar.gz |
Fix PDisk log flush completion action use after free (#1359)
Fixes #1382
-rw-r--r-- | ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp | 19 | ||||
-rw-r--r-- | ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h | 1 |
2 files changed, 11 insertions, 9 deletions
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp index dfa78979f0..44d5bb98a1 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp @@ -13,27 +13,28 @@ class TLogFlushCompletionAction : public TCompletionAction { const ui32 EndChunkIdx; const ui32 EndSectorIdx; THolder<TLogWriter> &CommonLogger; + TCompletionAction* CompletionLogWrite; public: TLogFlushCompletionAction(ui32 endChunkIdx, ui32 endSectorIdx, THolder<TLogWriter> &commonLogger, TCompletionAction* completionLogWrite) : EndChunkIdx(endChunkIdx) , EndSectorIdx(endSectorIdx) - , CommonLogger(commonLogger) { - this->FlushAction = completionLogWrite; - } + , CommonLogger(commonLogger) + , CompletionLogWrite(completionLogWrite) { } void Exec(TActorSystem *actorSystem) override { CommonLogger->FirstUncommitted = TFirstUncommitted(EndChunkIdx, EndSectorIdx); - - Y_DEBUG_ABORT_UNLESS(FlushAction); - - // FlushAction here is a TCompletionLogWrite which will decrease owner's inflight count. - FlushAction->Exec(actorSystem); + + CompletionLogWrite->SetResult(Result); + CompletionLogWrite->SetErrorReason(ErrorReason); + CompletionLogWrite->Exec(actorSystem); delete this; } void Release(TActorSystem *actorSystem) override { - FlushAction->Release(actorSystem); + CompletionLogWrite->SetResult(Result); + CompletionLogWrite->SetErrorReason(ErrorReason); + CompletionLogWrite->Release(actorSystem); delete this; } diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h index 5dc1eba7a6..641ca889ad 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h @@ -196,6 +196,7 @@ struct TOwnerData { CurrentFirstLsnToKeep = 0; LastWrittenCommitLsn = 0; CutLogId = TActorId(); + LogEndPosition = TLogEndPosition(0, 0); WhiteboardProxyId = TActorId(); LogRecordsInitiallyRead = 0; LogRecordsConsequentlyRead = 0; |