Skip to content

GH-51604: [C++][Parquet] Only link opentelemetry-cpp::sdk on arrow_reader_writer_tracing_test.cc to avoid double freeing - #51606

Merged
kou merged 3 commits into
apache:mainfrom
raulcd:GH-51604
Sep 28, 2026
Merged

kou merged 3 commits into
apache:mainfrom
raulcd:GH-51604

Conversation

@raulcd

@raulcd raulcd commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

ASAN and TSAN jobs were failing due to double freeing opentelemetry globals.

What changes are included in this PR?

Avoid linking all OpenTelemetry libs and only link opentelemetry-cpp::sdk to the test to avoid double free as OpenTelemetry is already linked in libarrow. ) opentelemetry-cpp::sdk adds the required include directories and compile definitions.

Are these changes tested?

Yes on CI

Are there any user-facing changes?

No

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Code was written by a human but I've used Claude Opus 5.5 in order to analyze the problem and brainstorm solutions.

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@github-actions github-actions Bot added the awaiting committer review Awaiting committer review label Sep 28, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #51604 has been automatically assigned in GitHub to PR creator.

@raulcd

raulcd commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-ubuntu-24.04-cpp-thread-sanitizer

@github-actions

Copy link
Copy Markdown

Revision: 2a3cc4c

Submitted crossbow builds: ursacomputing/crossbow @ actions-429379b10c

Task Status
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@raulcd

raulcd commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-ubuntu-24.04-cpp-thread-sanitizer

@github-actions

Copy link
Copy Markdown

Revision: 2b7b573

Submitted crossbow builds: ursacomputing/crossbow @ actions-99c824cce4

Task Status
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@raulcd
raulcd marked this pull request as ready for review September 28, 2026 09:18
@raulcd
raulcd requested review from adamreeve and a lite review from Copilot September 28, 2026 09:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Include the OpenTelemetry API target’s include directories and compile definitions.

Review effort: Lite
Findings: None

What changed in this PR

Updates the Parquet tracing test to avoid duplicate OpenTelemetry linking and sanitizer failures.

Changes:

  • Removes direct OpenTelemetry test linkage.
  • Adds required include directories and compile definitions.
  • Preserves tracing test configuration.
File Summary
cpp/​src/​parquet/​CMakeLists.txt Updates OpenTelemetry linkage and compilation settings; API target properties still need to be included.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pitrou

pitrou commented Sep 28, 2026

Copy link
Copy Markdown
Member

@kou Can you take a look?

@adamreeve adamreeve left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sensible to me

@kou kou added the CI: Extra: Package: Linux Run extra Linux Packages CI label Sep 28, 2026
Comment thread cpp/src/parquet/CMakeLists.txt Outdated
Comment on lines +422 to +425
EXTRA_INCLUDES
$<TARGET_PROPERTY:opentelemetry-cpp::trace,INTERFACE_INCLUDE_DIRECTORIES>
DEFINITIONS
$<TARGET_PROPERTY:opentelemetry-cpp::trace,INTERFACE_COMPILE_DEFINITIONS>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use opentelemetry-cpp::sdk instead? It seems that opentelemetry-cpp::sdk just provides include path and definitions.

diff --git a/cpp/src/parquet/CMakeLists.txt b/cpp/src/parquet/CMakeLists.txt
index 59ac952652..a5519cc5a2 100644
--- a/cpp/src/parquet/CMakeLists.txt
+++ b/cpp/src/parquet/CMakeLists.txt
@@ -417,7 +417,7 @@ if(ARROW_WITH_OPENTELEMETRY AND NOT ARROW_USE_ASAN)
                    SOURCES
                    arrow/arrow_reader_writer_tracing_test.cc
                    EXTRA_LINK_LIBS
-                   ${ARROW_OPENTELEMETRY_LIBS})
+                   opentelemetry-cpp::sdk)
 endif()
 
 add_parquet_test(arrow-index-test SOURCES arrow/index_test.cc)

@raulcd raulcd Sep 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kou, I tested locally and it does seem that linking only opentelemetry-cpp::sdk solves indeed the ASAN/TSAN issues. I have pushed the change.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Sep 28, 2026
…ARROW_OPENTELEMETRY_LIBS or manually defining EXTRA_INCLUDES and DEFINITIONS
Copilot AI review requested due to automatic review settings September 28, 2026 12:12
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 28, 2026
@raulcd

raulcd commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit test-ubuntu-24.04-cpp-thread-sanitizer

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The ASAN/OpenTelemetry compatibility issue remains unresolved.

Review effort: Lite
Findings: None

@raulcd raulcd changed the title GH-51604: [C++][Parquet] Avoid double linking OpenTelemetry on arrow_reader_writer_tracing_test.cc GH-51604: [C++][Parquet] Only link opentelemetry-cpp::sdk on arrow_reader_writer_tracing_test.cc to avoid double freeing Sep 28, 2026
@github-actions

Copy link
Copy Markdown

Revision: 2f4ee12

Submitted crossbow builds: ursacomputing/crossbow @ actions-f90e47a28f

Task Status
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Sep 28, 2026

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@kou
kou merged commit 7bc31d7 into apache:main Sep 28, 2026
77 of 79 checks passed
@kou kou removed the awaiting changes Awaiting changes label Sep 28, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Sep 28, 2026
@raulcd
raulcd deleted the GH-51604 branch September 29, 2026 08:08
kou pushed a commit that referenced this pull request Sep 29, 2026
…writer-tracing-test depending on System vs Bundled OpenTelemetry (#51633)

### Rationale for this change

After merging #51606 some debian jobs that use System opentelemetry were failing with missing symbols.

### What changes are included in this PR?

Change what we link depending on bundled vs system OpenTelemetry.

### Are these changes tested?

Yes all the CI jobs that the previous issue and this new issue had failing have been exercised and are successful

### Are there any user-facing changes?

No

### Was AI used for this PR?

In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR.

**PR code and description written by:**

- [x] Human
- [ ] AI

**Reviewed before submission by:**

- [x] Human
- [ ] AI
- [ ] Not reviewed

* GitHub Issue: #51632

Authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants