]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Create ParallelPGMapper object before start threadpool 58919/head
authorMohit Agrawal <moagrawa@redhat.com>
Wed, 3 Jul 2024 09:48:03 +0000 (15:18 +0530)
committerMohit Agrawal <moagrawa@redhat.com>
Tue, 30 Jul 2024 06:23:42 +0000 (11:53 +0530)
In the case of creating a ParallelPGMapper object after
starting the threadpool the test case might crash.
The test case is crash while worker thread is trying to
delete a job but the object is still in the construction phase
not fully constructed.

Solution: To avoid a crash create the object before start
          a threadpool.

Fixes: https://tracker.ceph.com/issues/42884
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
(cherry picked from commit d17efaf388bc20f0d72bb4a9a4b17d4281779f69)

src/test/osd/TestOSDMap.cc

index 31e34b5e2815dfb305742cc36c79ada3671be5c6..2c1d2f1209247a6fd7efa9bc5880db66ec0d195b 100644 (file)
@@ -308,8 +308,8 @@ public:
     int cpu_num = 8;
     int pgs_per_chunk = 256;
     ThreadPool tp(cct, "BUG_40104::clean_upmap_tp", "clean_upmap_tp", cpu_num);
-    tp.start();
     ParallelPGMapper mapper(cct, &tp);
+    tp.start();
     vector<pg_t> pgs_to_check;
     om.get_upmap_pgs(&pgs_to_check);
     OSDMonitor::CleanUpmapJob job(cct, om, pending_inc);