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 conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class HomeObjectConan(ConanFile):
name = "homeobject"
version = "4.1.4"
version = "4.1.5"

homepage = "https://github.com/eBay/HomeObject"
description = "Blob Store built on HomeStore"
Expand Down
10 changes: 10 additions & 0 deletions src/lib/homestore_backend/gc_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,16 @@ bool GCManager::pdev_gc_actor::purge_reserved_chunk(chunk_id_t chunk, const uint
"chunk_id={} is a reserved chunk, expected to have a GC state, but actuall state is {} ", chunk,
vchunk->m_state);

// Clear all rreqs on the reserved chunk BEFORE reset() resets its allocator.
// This prevents race conditions where:
// 1. Stale rreq frees blk on NEW allocator after reset (wrong allocator)
// 2. Stale rreq frees blk on OLD allocator during reset (accessing destroyed superblock)
// NOTE: This introduces potential double-free risk with gc_repl_reqs() background thread.
// See https://github.com/eBay/HomeObject/issues/401.
GCLOGD(task_id, pg_id, NO_SHARD_ID, "clear all rreqs on chunk={} before resetting it", vchunk->get_chunk_id());
auto hs_pg = m_hs_home_object->get_hs_pg(pg_id);
hs_pg->repl_dev_->clear_chunk_req(vchunk->get_chunk_id());

GCLOGD(task_id, pg_id, NO_SHARD_ID, "reset chunk={} before using it for gc", vchunk->get_chunk_id());
vchunk->reset(); // reset the chunk to make sure it is empty

Expand Down
2 changes: 1 addition & 1 deletion src/lib/homestore_backend/heap_chunk_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ csharedChunk HeapChunkSelector::select_specific_chunk(const pg_id_t pg_id, const

if (chunk->m_state == ChunkState::GC) {
LOGDEBUGMOD(homeobject, "v_chunk_id={} for pg={} is pchunk_id={}, in GC state, wait and retry!",
chunk->get_chunk_id(), v_chunk_id, pg_id);
v_chunk_id, pg_id, chunk->get_chunk_id());
} else {
if (chunk->m_state == ChunkState::AVAILABLE) {
chunk->m_state = ChunkState::INUSE;
Expand Down
Loading