RestCatalog: concurrent HTTP requests can crash in libcurl

Aberta
#1,089 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

@smaheshwar-pltr já está trabalhando nisso.

Desde 4/11/2026.

  • #1090 de @smaheshwar-pltr — aberto

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
20/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
cpp
Domínio
backend, networking

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
C++
Estrelas
227
Forks
142
Merge médio
3d 21min
PRs com merge (30d)
70

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de apache/iceberg-cpp

Todas as issues de apache/iceberg-cpp

Issues semelhantes

Mais issues de C++

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.