adam-markovics commented on a change in pull request #1252:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1252#discussion_r815979616



##########
File path: extensions/rocksdb-repos/FlowFileRepository.h
##########
@@ -75,24 +75,28 @@ class FlowFileRepository : public core::Repository, public 
std::enable_shared_fr
                      int64_t maxPartitionBytes = 
MAX_FLOWFILE_REPOSITORY_STORAGE_SIZE,
                      std::chrono::milliseconds purgePeriod = 
FLOWFILE_REPOSITORY_PURGE_PERIOD)
       : core::SerializableComponent(repo_name),
-        Repository(repo_name.length() > 0 ? repo_name : 
core::getClassName<FlowFileRepository>(), directory, maxPartitionMillis, 
maxPartitionBytes, purgePeriod),
-        checkpoint_dir_(checkpoint_dir),
+        Repository(repo_name.length() > 0 ? repo_name : 
core::getClassName<FlowFileRepository>(), std::move(directory), 
maxPartitionMillis, maxPartitionBytes, purgePeriod),
+        checkpoint_dir_(std::move(checkpoint_dir)),
         content_repo_(nullptr),
         checkpoint_(nullptr),
         logger_(logging::LoggerFactory<FlowFileRepository>::getLogger()) {
-    db_ = NULL;
+    db_ = nullptr;
   }
 
-  virtual bool isNoop() {
+  ~FlowFileRepository() override {
+    stop();
+  }

Review comment:
       The problem is that the `Repository` destructor and stop is called after 
derived class is already destructed with all of its members. Running thread was 
still trying to use these members. Therefore it consistently produced SIGSEGV 
errors as soon as these destructors were actually called.
   For example, at line 215 in this file:
   `thread_ = std::thread(&FlowFileRepository::run, this);`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to