Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadTableHandlers not exception safe #13303

Open
Ignition opened this issue Jan 16, 2025 · 1 comment
Open

LoadTableHandlers not exception safe #13303

Ignition opened this issue Jan 16, 2025 · 1 comment

Comments

@Ignition
Copy link

#2  0x000055a53cb70c3a in __cxxabiv1::__terminate(void (*)()) ()
#3  0x000055a53cb70ca5 in std::terminate() ()
#4  0x000055a53c768a81 in std::vector<std::thread, std::allocator<std::thread> >::~vector() ()
#5  0x000055a53c8f3d3a in rocksdb::VersionBuilder::Rep::LoadTableHandlers(rocksdb::InternalStats*, int, bool, bool, std::shared_ptr<rocksdb::SliceTransform const> const&, unsigned long) ()

Relevant code

std::vector<port::Thread> threads;
for (int i = 1; i < max_threads; i++) {
  threads.emplace_back(load_handlers_func);
}
load_handlers_func();
for (auto& t : threads) {
  t.join();
}

As far as I can tell either an exception came from emplace_back or from load_handlers_func. But in either case it caused the std::thread's destructor to have an issue because it wasn't joined yet and hence std::terminate was called.

std::thread::~thread If *this has an associated thread (joinable() == true), std::terminate() is called.

@Ignition
Copy link
Author

Also unrelated observation, maybe worth adding if (files_meta.empty()) return Status::OK(); before making any worker threads.

Ignition added a commit to memgraph/memgraph that referenced this issue Jan 17, 2025
Ignition added a commit to memgraph/memgraph that referenced this issue Jan 17, 2025
Ignition added a commit to memgraph/memgraph that referenced this issue Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant