{"record":{"id":"f3d42863a3f990b0","repo":"apache/beam","slug":"caught-exception-whilw-trying-to-close-append-client","errorCode":null,"errorMessage":"Caught exception whilw trying to close append client. Ignoring","messagePattern":"Caught exception whilw trying to close append client\\. Ignoring","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/AppendClientInfo.java","lineNumber":149,"sourceCode":"      String streamName = getStreamName.get();\n      BigQueryServices.StreamAppendClient client =\n          writeStreamService.getStreamAppendClient(\n              streamName, getDescriptor(), useConnectionPool, missingValueInterpretation);\n\n      activeStreamAppendClients.inc();\n\n      return toBuilder().setStreamName(streamName).setStreamAppendClient(client).build();\n    }\n  }\n\n  public void close() {\n    BigQueryServices.StreamAppendClient client = getStreamAppendClient();\n    if (client != null) {\n      try {\n        getCloseAppendClient().accept(client);\n      } catch (Exception e) {\n        // We ignore errors when closing clients.\n        LOG.warn(\"Caught exception whilw trying to close append client. Ignoring\", e);\n      }\n      activeStreamAppendClients.dec();\n    }\n  }\n\n  @Memoized\n  public byte[] getTableSchemaHash() {\n    return TableRowToStorageApiProto.tableSchemaHash(getTableSchema());\n  }\n\n  boolean hasSchemaChanged(TableSchema updatedTableSchema) {\n    return updatedTableSchema.hashCode() != getTableSchema().hashCode();\n  }\n\n  public ByteString encodeUnknownFields(TableRow unknown, boolean ignoreUnknownValues)\n      throws TableRowToStorageApiProto.SchemaConversionException {\n    Message msg =\n        Preconditions.checkArgumentNotNull(","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/AppendClientInfo.java#L131-L167","documentation":"AppendClientInfo.close() attempts to close the BigQuery Storage Write StreamAppendClient via getCloseAppendClient().accept(client); any exception is deliberately swallowed with this (typo'd) warning, since close failures are harmless — the stream is abandoned anyway and the active-clients gauge is decremented. Note the typo 'whilw' is the library's own message text.","triggerScenarios":"Any exception thrown while closing a Storage API append client during DoFn teardown — e.g. the underlying gRPC channel is already terminated, or the stream was closed server-side.","commonSituations":"Worker shutdown while stream was already DEAD/CLOSED; test pipelines ending with open streams; calling close twice; network unavailable at teardown.","solutions":["No action needed: close errors are intentionally ignored and the client count is still decremented.","If warnings are noisy at shutdown, drain/flush pipelines before stopping workers.","Verify the stream was not already closed in your code path (avoid double-close of StreamAppendClient)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// library already swallows close errors; mirror this pattern in user code\ntry {\n  client.close();\n} catch (Exception e) {\n  LOG.warn(\"close failed, ignoring\", e);\n}","preventionTips":["Don't close a StreamAppendClient twice.","Drain/flush before teardown to reduce close-time errors.","Treat close warnings at shutdown as benign."],"tags":["bigquery","grpc","resource-cleanup","java"],"backgroundTag":"resource-cleanup-failure","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}