[SERVER-57171] Make the killop test more resilient Created: 24/May/21  Updated: 29/Oct/23  Resolved: 27/May/21

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 5.1.0-rc0, 5.0.5

Type: Bug Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Amirsaman Memaripour
Resolution: Fixed Votes: 0
Labels: servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Steps To Reproduce:

Apply the following patch:

diff --git a/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp b/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp
index 70a8eb6663..7bca91e242 100644
--- a/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp
+++ b/src/mongo/embedded/mongo_embedded/mongo_embedded_test.cpp
@@ -45,6 +45,7 @@
 #include "mongo/stdx/thread.h"
 #include "mongo/unittest/temp_dir.h"
 #include "mongo/unittest/unittest.h"
+#include "mongo/util/duration.h"
 #include "mongo/util/options_parser/environment.h"
 #include "mongo/util/options_parser/option_section.h"
 #include "mongo/util/options_parser/options_parser.h"
@@ -356,6 +357,8 @@ TEST_F(MongodbCAPITest, KillOp) {
         auto currentOpMsg = mongo::OpMsgRequest::fromDBAndBody("admin", currentOpObj);
         mongo::BSONObj outputBSON;
 
+        sleepFor(mongo::Seconds(10));
+
         // Wait for the sleep command to start in the main test thread.
         int opid = -1;
         do {

Participants:
Linked BF Score: 45

 Description   

The MongodbCAPITest::KillOp test verifies the behavior of killop by:

  • Running a long running operation: {'sleep': {'secs': 1000}}
  • Spawning a thread that kills the long running operation (once it appears in currentOp).
  • Verifying that the long running operation is not successful and returns ErrorCodes::Interrupted.

The test may fail if the spawned thread takes too long (~10 seconds in observed failures) before killing the operation. Moreover, the assertions in the test are not thread-safe and should use the ThreadAssertionMonitor.

The test should adopt ThreadAssertionMonitor and properly handle incidents in which the operation is not killed in time (and returns with an okay status).



 Comments   
Comment by Githook User [ 08/Nov/21 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-57171 Make the killop test more resilient

(cherry picked from commit 3a48403f63ed65e076e0cd44cccf0f89123f8e86)
Branch: v5.0
https://github.com/mongodb/mongo/commit/28136c4dd97e017e9b95c5f8d3f2c4de518a4a91

Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 27/May/21 ]

Author:

{'name': 'Amirsaman Memaripour', 'email': 'amirsaman.memaripour@mongodb.com', 'username': 'samanca'}

Message: SERVER-57171 Make the killop test more resilient
Branch: master
https://github.com/mongodb/mongo/commit/3a48403f63ed65e076e0cd44cccf0f89123f8e86

Generated at Thu Feb 08 05:41:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.