Skip to content

fix: Guard getTransport() call in setTransaction for GCC.#151

Merged
20001020ycx merged 1 commit intoy-scope:release-0.297-edge-10-clp-connectorfrom
20001020ycx:fix/gcc-sigsegv-setTransaction
Mar 6, 2026
Merged

fix: Guard getTransport() call in setTransaction for GCC.#151
20001020ycx merged 1 commit intoy-scope:release-0.297-edge-10-clp-connectorfrom
20001020ycx:fix/gcc-sigsegv-setTransaction

Conversation

@20001020ycx
Copy link
Copy Markdown

@20001020ycx 20001020ycx commented Mar 6, 2026

Description

See #152 for complete background.

GCC generates incorrect code in Release mode (-O3) for txn_->getTransport().getCodec().getProtocol() in setTransaction(), causing SIGSEGV at address 0x0 during worker-to-coordinator HTTP connection. This is the same class of bug as prestodb#22995.

The existing fix (PR prestodb#23531) only guarded the createTransaction() code path. This applies the same #if defined(clang) pattern to the setTransaction() code path added in the 0.297 integration.

The protocol_ field is std::optional and only used for a VLOG(2) debug log in onHeadersComplete(), so skipping the assignment on GCC has no functional impact.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

E2E Testing Infra:
Built both Docker images locally from a branch combining the SIGSEGV fix (this PR) and the CLP plugin packaging fix (#149), using the same build steps and args as CI:

  1. Dependency image: Built from ubuntu-22.04-dependency.dockerfile
  2. Worker image: Built from prestissimo-runtime.dockerfile
  3. Coordinator image: Built from docker/Dockerfile using the Maven-produced presto-server-0.297-edge10.1-SNAPSHOT.tar.gz (verified presto-clp plugin is included in the tarball)

E2E Test

Started coordinator and worker containers using the locally built images with the existing docker-compose.yaml deployment configuration.

The below query returns expected result

 SELECT timestamp, CLP_GET_JSON_STRING()
  FROM clp.default.default
  WHERE "timestamp" >= TIMESTAMP '2023-03-27 00:41:39.863'
  LIMIT 100

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced HTTP client stability and reliability by addressing critical issues in idle session management and protocol handling operations. These targeted improvements eliminate unexpected application crashes occurring during specific runtime scenarios. The enhancements ensure consistent, dependable performance across all execution environments, reducing failures in normal operations.

GCC generates incorrect code in Release mode (-O3) for
txn_->getTransport().getCodec().getProtocol() in setTransaction(),
causing SIGSEGV at address 0x0 during worker-to-coordinator HTTP
connection. This is the same class of bug as prestodb#22995.

The existing fix (PR prestodb#23531) only guarded the createTransaction() code
path. This applies the same #if defined(__clang__) pattern to the
setTransaction() code path added in the 0.297 integration.

The protocol_ field is std::optional and only used for a VLOG(2) debug
log in onHeadersComplete(), so skipping the assignment on GCC has no
functional impact.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

This change adds compiler-specific conditional guards in the HTTP client code to prevent segmentation faults on GCC builds. Two code paths are now restricted to clang-only execution: protocol retrieval in ResponseHandler::setTransaction and an event-base thread safety check in idle session handling.

Changes

Cohort / File(s) Summary
Compiler-specific GCC workarounds
presto-native-execution/presto_cpp/main/http/HttpClient.cpp
Added clang-only conditional guards around protocol retrieval in ResponseHandler::setTransaction and event-base/thread safety check in idle session handling to prevent SIGSEGV on GCC (Presto issue 22995).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description provides detailed context about the GCC code-generation bug, references the underlying issue, explains the fix pattern, and validates testing. However, it does not follow the required template structure with sections for Motivation and Context, Impact, Test Plan, Contributor checklist, and Release Notes. Restructure the description to follow the template format: add explicit sections for Motivation and Context, Impact, Test Plan, complete the Contributor checklist, and provide Release Notes following the guidelines.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: guarding a getTransport() call in setTransaction for GCC to fix a SIGSEGV issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@20001020ycx 20001020ycx changed the title fix: Guard getTransport() call in setTransaction for GCC fix: Guard getTransport() call in setTransaction for GCC. Mar 6, 2026
@20001020ycx 20001020ycx merged commit ba677bc into y-scope:release-0.297-edge-10-clp-connector Mar 6, 2026
15 of 16 checks passed
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

Successfully merging this pull request may close these issues.

2 participants