From: Mohit Agrawal Date: Wed, 12 Jun 2024 11:49:18 +0000 (+0530) Subject: unittest_osdmap aborted during OSDMapTest.BUG_42485 X-Git-Tag: v20.0.0~1722^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F57988%2Fhead;p=ceph.git unittest_osdmap aborted during OSDMapTest.BUG_42485 The testcase is aborted during the call of clean_upmap_tp thread. The function(clean_pg_upmaps) spawns a number of worker threads to process a PGMapper job. The worker thread fetch a job from the queue and then process the job and call process_finish the job. The process function of PGMapper class destroying the object and as worker thread call _process_finish function it crashes because job pointer has become a dangling pointer. Solution: To avoid a crash destroy the object in _process_finish instead of doing in _process. Fixes: https://tracker.ceph.com/issues/62934 Signed-off-by: Mohit Agrawal --- diff --git a/src/osd/OSDMapMapping.cc b/src/osd/OSDMapMapping.cc index 9cd1fbf58238..bc53bddecde4 100644 --- a/src/osd/OSDMapMapping.cc +++ b/src/osd/OSDMapMapping.cc @@ -158,7 +158,6 @@ void ParallelPGMapper::WQ::_process(Item *i, ThreadPool::TPHandle &h) else i->job->process(i->pool, i->begin, i->end); i->job->finish_one(); - delete i; } void ParallelPGMapper::queue( diff --git a/src/osd/OSDMapMapping.h b/src/osd/OSDMapMapping.h index 216c30446a95..40193b582f61 100644 --- a/src/osd/OSDMapMapping.h +++ b/src/osd/OSDMapMapping.h @@ -144,6 +144,7 @@ protected: } void _process(Item *i, ThreadPool::TPHandle &h) override; + void _process_finish(Item *i) override { delete i;} void _clear() override { ceph_assert(_empty());