apache/beam · error

Error closing Flight write connection during teardown

Error message

Error closing Flight write connection during teardown

What it means

WARN logged in the @Teardown method of ArrowFlightIO's write function: closeConnection() threw a RuntimeException during teardown. Teardown is best-effort, so the exception is caught and logged instead of failing the bundle; the write connection and its resources are simply abandoned, which the runner's own process cleanup handles.

Solutions

  1. Check the logged exception to find why the Flight connection failed to close (server down, network)
  2. Ensure Flight servers remain reachable through job teardown, or accept the leak-free abandonment
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at sdks/java/io/arrow-flight/src/main/java/org/apache/beam/sdk/io/arrowflight/ArrowFlightIO.java:675 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/3563a15d4020b159. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/arrow-flight/src/main/java/org/apache/beam/sdk/io/arrowflight/ArrowFlightIO.java:675

      } catch (RuntimeException e) {
        if (failure == null) {
          failure = e;
        } else {
          failure.addSuppressed(e);
        }
      }

      if (failure != null) {
        throw failure;
      }
    }

    @Teardown
    public void teardown() {
      try {
        closeConnection();
      } catch (RuntimeException e) {
        LOG.warn("Error closing Flight write connection during teardown", e);
      }
    }

    private void ensureConnection() {
      if (client == null) {
        BufferAllocator currentAllocator = new RootAllocator(Long.MAX_VALUE);
        allocator = currentAllocator;
        FlightClient currentClient =
            createClient(
                currentAllocator, checkNotNull(spec.host(), "host"), spec.port(), spec.useTls());
        client = currentClient;

        org.apache.arrow.vector.types.pojo.Schema arrowSchema =
            ArrowConversion.ArrowSchemaTranslator.toArrowSchema(beamSchema);
        VectorSchemaRoot currentRoot = VectorSchemaRoot.create(arrowSchema, currentAllocator);
        root = currentRoot;

        FlightDescriptor descriptor =

View on GitHub (pinned to 12126d8942)