SLoeuillet opened a new issue, #2078:
URL: https://github.com/apache/iceberg-go/issues/2078

   ### Apache Iceberg version
   
   v0.7.0-rc0 (also on `main`)
   
   ### Please describe the bug 🐞
   
   With a REST catalog that vends credentials, a `*table.Table`'s FileIO is 
cached by `vendedCredentialRefresher.loadFS`, which builds it with the `ctx` of 
the **first** call (`iceio.LoadFS(ctx, …)` in `catalog/rest/vended_creds.go`; 
for GCS, `gcsblob.OpenBucket(ctx, …)` → `storage.NewClient(ctx, …)`). Once that 
context is cancelled, every later write through the same table fails with 
`context canceled`, even when called with a fresh, live context.
   
   This bites any long-running writer that scopes each commit to its own 
context (e.g. `context.WithTimeout`, cancelled when the commit returns): the 
first commit succeeds, every later one fails. Renewal has the same issue, since 
the refreshed IO is also built with the caller's `ctx`. Tables loaded without 
vended credentials are unaffected: `LoadFSFunc` builds a new IO per call.
   
   Seen with Lakekeeper v0.13.3 and a native GCS warehouse (vended 
`gcs.oauth2.token`).
   
   **Repro** (same table object, two appends):
   
   ```go
   t, _ := cat.LoadTable(bg, id)
   
   ctx1, cancel1 := context.WithCancel(bg)
   t, err := t.AppendTable(ctx1, batch(1), 10, nil) // ok
   cancel1()
   
   ctx2, cancel2 := context.WithCancel(bg)
   defer cancel2()
   _, err = t.AppendTable(ctx2, batch(2), 10, nil)
   // error in rolling data writer: context canceled
   ```
   
   Without `cancel1()`, the second append succeeds.
   
   **Suggested fix:** build the cached IO (and the `prefixScopedIO`, which 
stores `ctx` too) from `context.WithoutCancel(ctx)`, so the cache does not 
outlive the context it was created with.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to