aws / aws/aws-s3-accessgrants-plugin-java-v2
NPE in AWS SDK v2 + S3 Access Grants when reading large Iceberg tables with S3FileIO (Spark, JDK17/JDK21)
- Dominant language
- Java
- Stars
- 8
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
When reading a large Iceberg table from S3 using S3FileIO with S3 Access Grants enabled, Spark jobs intermittently fail with a NullPointerException inside the AWS SDK v2 AttributeMap$Builder.resolveValue, called from S3AccessGrantsIdentityProvider.resolveIdentity.
This only appears under high concurrency / large datasets (e.g., spark.read.table(...).count() over many files). Smaller tables or lower parallelism may run successfully, but increasing parallelism makes the failure reproducible.
The error message from the AWS SDK is:
Encountered a null value when resolving configuration attributes. This is commonly caused by concurrent modifications to non-thread-safe types. Ensure you're synchronizing access to all non-thread-safe types.
From the Iceberg side we are using S3FileIO with S3 Access Grants configured according to the docs, and the S3 client is built via S3Client.builder() with S3FileIOProperties.applyS3AccessGrantsConfigurations(...) (or equivalent).
```
java.lang.NullPointerException: Cannot invoke "software.amazon.awssdk.utils.AttributeMap$Value.get(software.amazon.awssdk.utils.AttributeMap$LazyValueSource)" because "value" is null
at software.amazon.awssdk.utils.AttributeMap$Builder.resolveValue(AttributeMap.java:396)
at software.amazon.awssdk.utils.AttributeMap$Builder.buildResolvedMap(AttributeMap.java:371)
at software.amazon.awssdk.utils.AttributeMap$Builder.build(AttributeMap.java:358)
...
at software.amazon.awssdk.s3accessgrants.plugin.S3AccessGrantsIdentityProvider.resolveIdentity(S3AccessGrantsIdentityProvider.java:...)
...
at software.amazon.awssdk.services.s3.S3Client.getObject(S3Client.java:...)
...
at org.apache.iceberg.io.ResolvingFileIO.newInputFile(ResolvingFileIO.java:...)
at org.apache.iceberg.io.FileIO.newInputFile(FileIO.java:...)
...
at org.apache.iceberg.spark.source.BaseDataReader.next(BaseDataReader.java:...)
at org.apache.iceberg.spark.source.SparkBatchScan$$anon$1.next(SparkBatchScan.scala:...)
...
```
We have already tried these below combos where still the NPE issue persist
Iceberg versions
1.7.2 and upgraded to 1.10.0 → NPE persists in both.
AWS SDK v2 versions
Tried 2.24.6, 2.30.31, 2.32.1→ NPE persists across all.
S3 Access Grants plugin versions
Tried 2.0.2 and 2.3.0 → NPE persists across both.
Spark / JDK combinations
Spark 3.5.6 with JDK17 and Spark 4.0.1 (JDK21 inside image) → same NPE in both.
Parallelism tuning - Reduced spark.sql.shuffle.partitions / spark.default.parallelism → can change frequency but does not reliably remove the NPE on large tables.
Could you please help me to understand the issue:
1. Is this a known concurrency issue?
We are seeing a NullPointerException in software.amazon.awssdk.utils.AttributeMap$Builder.resolveValue, called from software.amazon.awssdk.s3accessgrants.plugin.S3AccessGrantsIdentityProvider.resolveIdentity, when using aws-s3-accessgrants-java-plugin under high concurrency (Spark reading large Iceberg tables from S3). Is this a known concurrency problem in the S3 Access Grants plugin or its interaction with AWS SDK v2?
2. Recommended version matrix (SDK v2 ↔ S3AG plugin)?
Is there a recommended or validated combination of:
AWS SDK v2 version, and
software.amazon.s3.accessgrants:aws-s3-accessgrants-java-plugin version
that you suggest for high‑concurrency workloads (e.g., Spark / Iceberg scanning many S3 objects) to avoid this NPE?
3. Configuration or usage guidance to avoid non‑thread‑safe state?
Are there any specific recommendations for configuring or using the S3 Access Grants plugin with S3Client.builder() in multi‑threaded environments (like Spark executors), to ensure that plugin configuration / AttributeMap usage is thread‑safe and does not lead to resolveValue seeing a null AttributeMap.Value?
Contributor guide
Assessment
This issue has not been assessed yet.