Abacn commented on issue #31422:
URL: https://github.com/apache/beam/issues/31422#issuecomment-2159010658

   There are two places closing the client:
   
   
https://github.com/apache/beam/blob/2ddfcfb1c18020d0c01c7ebfe5d898a5b8a303b6/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWriteUnshardedRecords.java#L392
   
   
https://github.com/apache/beam/blob/2ddfcfb1c18020d0c01c7ebfe5d898a5b8a303b6/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWritesShardedRecords.java#L517
   
   Apparent racing condition most likely client already marked closed here, 
then in 
   
   
https://github.com/apache/beam/blob/2ddfcfb1c18020d0c01c7ebfe5d898a5b8a303b6/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWritesShardedRecords.java#L600
   
   it tries to use the client and fails precondition.
   
   It's hard to locate where the client get closed (async and lambda 
programming code style). Basically, there is a APPEND_CLIENTS cache:
   
   
https://github.com/apache/beam/blob/2ddfcfb1c18020d0c01c7ebfe5d898a5b8a303b6/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/StorageApiWritesShardedRecords.java#L181
   
   removal of cache item will trigger `appendClientInfo.close` which calls 
`getCloseAppendClient().accept(client)` that is the code above.
   
   Then what happens is the cache entry contains the client get invalidated 
before it's going to be used again.


-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to