RestCatalog: concurrent HTTP requests can crash in libcurl

未关闭
#1,089 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@smaheshwar-pltr 已经在做这个了。

开始于 2026年11月4日。

  • #1090 来自 @smaheshwar-pltr —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
20/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
cpp

调研方向

Start with src/iceberg/catalog/rest/http_client.cc around line 201, where HttpClient uses the shared cpr::ConnectionPool, and review issue #530 for the earlier mutex guarded session. Reproduce the concurrent requests against the REST fixture used by rest_catalog_integration_test, then inspect the client and pool behavior with the libcurl versions named in the issue. Done means concurrent requests no longer trigger the reported crash; pull request #1090 is already open.

由索引模型根据 Issue 内容生成。

描述

HttpClient sends every request through one cpr::ConnectionPool (http_client.cc#L201). That pool wraps a libcurl share handle that shares the connection cache, and libcurl doesn't support using a shared connection cache from several threads at once. When two requests overlap, the process can crash.

A RestCatalog sends all its requests through one HttpClient, so requests can overlap even when the application only calls the catalog from one thread:

Applications that share one catalog between threads run into it directly.

The shared pool was introduced in apache/iceberg-cpp#530, which replaced a mutex-guarded cpr::Session.

Reproduction

Run this against the REST fixture that rest_catalog_integration_test uses:

HttpClient client;
auto session = auth::AuthSession::MakeDefault({});
std::vector<std::thread> threads;
for (int i = 0; i < 32; ++i) {
  threads.emplace_back([&] {
    for (int j = 0; j < 200; ++j) {
      (void)client.Get("http://localhost:8181/v1/config", {}, {},
                       *DefaultErrorHandler::Instance(), *session);
    }
  });
}
for (auto& thread : threads) thread.join();

With libcurl 8.22.0, this aborted in 6 of 6 runs with heap corruption (free(): corrupted unsorted chunks or double free or corruption). Sharing one RestCatalog between 32 threads that each call LoadTable also crashes, with both 8.22.0 and 8.5.0. Neither reproduces with 8.18.0, the version CI uses, so CI doesn't catch it.

主要语言
C++
星标
227
派生
142
平均合并
3 天 21 分钟
30 天内合并 PR
70

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/iceberg-cpp 的其他 Issue

查看 apache/iceberg-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。