Repository navigation
Conversation
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
|
@github-actions crossbow submit wheelcp312* |
|
Revision: 48d2ad9 Submitted crossbow builds: ursacomputing/crossbow @ actions-b78ab357f0 |
|
@github-actions crossbow submit -g python |
|
Revision: 48d2ad9 Submitted crossbow builds: ursacomputing/crossbow @ actions-73a6328000 |
|
@github-actions crossbow submit wheelcp313* |
|
Revision: 48d2ad9 Submitted crossbow builds: ursacomputing/crossbow @ actions-056618efab |
|
Revision: 48d2ad9 Submitted crossbow builds: ursacomputing/crossbow @ actions-c6b0d8e743 |
|
Hey, Thanks for the PR. I'm currently having issues with the deadlock. I was wondering if there is a chance that this PR is going to be deployed one day ? |
|
@ROMNEUVILLE Are you able to test the PR? We don't know whether it's fixing the issue. |
#55881) ### Rationale for this change Since Arrow 24, `finalize_s3()` hangs forever if an `S3FileSystem` using web identity credentials is still alive, and so does interpreter exit. Web identity credentials means `AWS_WEB_IDENTITY_TOKEN_FILE` + `AWS_ROLE_ARN`, e.g. EKS IRSA. The issue has a deterministic repro using a bogus token. This is a lifetime issue, not a race: * In the bundled AWS SDK 1.11.778, `STSAssumeRoleWebIdentityCredentialsProvider` became a `CrtCredentialsProvider`. It's created with `GetDefaultClientBootstrap()`, so while it is alive it holds a reference to the default `ClientBootstrap`. In 1.11.587, used by Arrow 23, it used `STSCredentialsClient` without CRT. * `S3ClientFinalizer` releases all `S3Client`s before `Aws::ShutdownAPI()`, but the credentials provider is also owned by `S3Options::credentials_provider` and `ClientBuilder::credentials_provider_`. A live `S3FileSystem` keeps it alive, so `ShutdownAPI()` waits forever for the bootstrap reference to go away. This is also why removing `EnableBlockingShutdown()` (#50193) is not enough. The wait moves to `~ApiHandle` → `aws_thread_join_all_managed`, as reported in the issue. ### What changes are included in this PR? * `FinalizableCredentialsProvider`: an `AWSCredentialsProvider` that delegates to the wrapped provider and drops it on finalization. After that it returns empty credentials. That isn't reachable through Arrow, because S3 operations already fail with "S3 finalized" at that point. * `S3ClientFinalizer` tracks these wrappers (weak refs) and finalizes them after the client holders. * `S3Options::ConfigureDefaultCredentials()` and `ConfigureAssumeRoleWithWebIdentityCredentials()` wrap their providers. These are the ones that can be CRT-based. A provider assigned directly to `S3Options::credentials_provider` by C++ users is not wrapped. Its lifetime remains the caller's responsibility. ### Are these changes tested? Yes: * A new `test_s3_finalize_with_live_web_identity_fs` runs in a subprocess with a timeout and needs no network. It covers both an explicit `finalize_s3()` and plain interpreter exit with a live filesystem. It times out without this change and passes with it. * The existing S3 tests in `test_fs.py` pass against minio. * Manually on a Linux build of this branch: the bogus-token repro from the issue now exits. * On an EKS pod with real IRSA credentials (x86_64), reading an object and then exiting works. The released 26.0.1 wheel hangs at exit in the same pod. ### Are there any user-facing changes? Processes using web identity credentials no longer hang in `finalize_s3()` or at exit. ### 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:** - [ ] Human - [x] AI **Reviewed before submission by:** - [x] Human - [x] AI - [ ] Not reviewed AI usage summary: * An AI coding assistant (Claude) helped trace the root cause through the Arrow and AWS SDK sources, wrote the code change, test and description, and ran the builds and repros. * I directed the investigation, reproduced the issue, and validated the fix on EKS with IRSA. * GitHub Issue: Closes #50188
Thanks for opening a pull request!
If this is your first pull request you can find detailed information on how to contribute here:
Please remove this line and the above text before creating your pull request.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
This PR includes breaking changes to public APIs. (If there are any breaking changes to public APIs, please explain which changes are breaking. If not, you can remove this.)
This PR contains a "Critical Fix". (If the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld), please provide explanation. If not, you can remove this.)