You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "piotrrzysko (via GitHub)" <gi...@apache.org> on 2026/08/10 05:24:34 UTC
[I] TableMetadata is not thread-safe [iceberg]
piotrrzysko opened a new issue, #17585:
URL: https://github.com/apache/iceberg/issues/17585
### Apache Iceberg version
1.11.0 (latest release)
### Query engine
Trino
### Please describe the bug 🐞
`RESTSessionCatalog`'s `RESTTableCache` caches `TableMetadata` and shares it across threads. `TableMetadata` itself handles this correctly - its lazy fields use `synchronized` + `volatile`. However, `BaseSnapshot` and `Schema`, reachable from `TableMetadata`, have lazily-initialized fields with no synchronization:
https://github.com/apache/iceberg/blob/7aa4f97fae8f6393950d925ca67e8331a780a20a/core/src/main/java/org/apache/iceberg/BaseSnapshot.java#L51-L57
https://github.com/apache/iceberg/blob/7aa4f97fae8f6393950d925ca67e8331a780a20a/api/src/main/java/org/apache/iceberg/Schema.java#L77-L83
`PartitionSpec` follows the same lazy pattern but correctly uses `synchronized` + `volatile`.
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org