westonpace commented on a change in pull request #12408:
URL: https://github.com/apache/arrow/pull/12408#discussion_r813224851
##########
File path: cpp/src/arrow/util/thread_pool.cc
##########
@@ -144,6 +145,13 @@ struct ThreadPool::State {
// after the ThreadPool is destroyed.
static void WorkerLoop(std::shared_ptr<ThreadPool::State> state,
std::list<std::thread>::iterator it) {
+#ifdef ARROW_WITH_OPENTELEMETRY
+ // The main thread may exit and start shutting down static state before
+ // this thread ends. This means that any calls to OpenTelemetry's static
+ // state will potentially access freed memory. By grabbing a handle we
+ // keep OpenTelemetry's static state alive until this thread ends.
+ internal::tracing::OtHandle handle = internal::tracing::Attach();
Review comment:
I switched to what I think you were intending. This basically inverts
the dependency so that OT has to call keepalive on the thread pools instead of
the other way around. The implementation's KeepAlive method was not static
though. Can you double check that I addressed your concerns here?
--
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]