RestCatalog: concurrent HTTP requests can crash in libcurl
Les mainteneurs répondent en général sous 2 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 20/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- cpp
- Domaine
- backend, networking
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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:
- Metrics reports are posted from the executor passed to
RestCatalog::Make(rest_metrics_reporter.cc#L73-L74). - OAuth2 tokens are refreshed on the
auth_executorpassed toRestCatalog::Make(auth_session_internal.h#L284). - Vended S3 credentials are refreshed through LoadCredentials when the AWS SDK signs a request. The refresh runs on whichever thread is doing the S3 I/O (arrow_s3_file_io.cc#L701-L708, rest_catalog.cc#L91).
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.
- Langage dominant
- C++
- Étoiles
- 227
- Forks
- 142
- Merge moyen
- 3 j 21 min
- PR mergées (30 j)
- 70
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/iceberg-cpp
-
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
apache/iceberg-cpp#1103 ·
Les mainteneurs répondent en général sous 2 jours
-
help wanted
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
apache/iceberg-cpp#1101 ·
Les mainteneurs répondent en général sous 2 jours
-
Support Iceberg SQL viewsOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
apache/iceberg-cpp#1099 ·
Les mainteneurs répondent en général sous 2 jours
-
Complete OAuth2 token refresh and expiration support (Java-compatible)Peut-être pris @lishuxu l’a pris il y a 2 jours. Ouverte
apache/iceberg-cpp#1095 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Make RestCatalog safe to share across threadsPeut-être pris @smaheshwar-pltr l’a pris il y a 3 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
apache/iceberg-cpp#1091 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/iceberg-cpp
Issues similaires
-
ai_p2
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
ClickHouse/ClickHouse#130006 ·
Les mainteneurs répondent en général sous 1 jour
-
DepotMaintain: EN longer string moves the hint popup buttons out of reach // WpfGUI English LanguageOuverteclient: WpfGui module: depot question
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
MaaAssistantArknights/MaaAssistantArknights#19169 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
area: certificates bug outdated-version
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
RafaelNGP/xbox-cloud-gaming-ps5#381 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
parse_selu lowering loses catastrophic cancellation → silent 0.0 for moderate positive inputsOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
ROCm/AMDMIGraphX#5490 ·
Les mainteneurs répondent en général sous 3 jours