Commit c570375
authored
fix: re-read sessionCache inside synchronized block in getOrCreateSessionCache (#242)
The double-checked locking pattern in getOrCreateSessionCache() had a bug:
the local variable 'cache' was not updated after another thread won the
initialization race inside the synchronized block. The losing thread would
return null, causing a NullPointerException at cache.cachedSession() in
tableSession() (line 94).
This surfaces when multiple threads call tableSession() simultaneously on
the first Iceberg commit — for example, when an Iceberg Kafka Connect sink
flushes several Parquet files in parallel. It became observable in
iceberg-kafka-connect 1.11.0 after apache/iceberg#13215 changed
S3V4RestSignerClient to call authManager().tableSession() on every S3
request instead of caching the session per instance.
Fix: re-read sessionCache from the volatile field inside the synchronized
block so the losing thread picks up the value set by the winner.1 parent 2d797e8 commit c570375
1 file changed
Lines changed: 2 additions & 1 deletion
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
0 commit comments