apache/seatunnel · error · EdgeSocketConnectorException

PACKET_DECODE_ERROR

PACKET_DECODE_ERROR

Error message

Payload decompression failed

What it means

EdgeSocketCompressionPayloadDeserializer.readAll() reads the decompressed packet bytes from the input stream into a byte array. Any IOException while streaming (truncated gzip/zlib stream, corrupt checksum, unexpected EOF) is wrapped as EdgeSocketConnectorException with code PACKET_DECODE_ERROR and message 'Payload decompression failed'. The original IOException is attached as the cause.

Solutions

  1. Check the attached IOException cause to confirm truncation vs corruption.
  2. Verify the sender writes and flushes the complete compressed payload before closing.
  3. Inspect network path (proxies, MTU, socket timeouts) for byte loss.
  4. Re-run with the producer writing uncompressed ('none') to isolate the compressor.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    byte[] payload = readAll(inputStream);
} catch (EdgeSocketConnectorException e) {
    if (e.getErrorCode() == EdgeSocketConnectorErrorCode.PACKET_DECODE_ERROR && e.getCause() instanceof IOException) {
        // log the truncated/corrupt packet and skip or reconnect
    }
}

Prevention

When it happens

Trigger: readAll() called from decompress() hits an IOException from the underlying GZIP/Inflater input stream — truncated payload, corrupted compressed bytes, or stream closed mid-read.

Common situations: Network truncation between sender and receiver, sender flushing incomplete compressed payloads, or a writer bug producing invalid gzip/zlib data.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/309e5fb39aeab03b. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/serialize/payload/EdgeSocketCompressionPayloadDeserializer.java:91

    /**
     * Read all bytes from factory-created stream and map IO failures to connector error.
     *
     * @param inputStreamFactory stream factory for concrete compression implementation
     * @return fully decompressed bytes
     */
    private byte[] readAll(InputStreamFactory inputStreamFactory) {
        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
            try (InputStream inputStream = inputStreamFactory.create()) {
                byte[] buffer = new byte[1024];
                int len;
                while ((len = inputStream.read(buffer)) != -1) {
                    baos.write(buffer, 0, len);
                }
            }
            return baos.toByteArray();
        } catch (IOException ioException) {
            throw new EdgeSocketConnectorException(
                    EdgeSocketConnectorErrorCode.PACKET_DECODE_ERROR,
                    "Payload decompression failed",
                    ioException);
        }
    }

    /** Lazily creates compression-specific input streams for payload decoding. */
    private interface InputStreamFactory {
        /**
         * Create input stream for decompression.
         *
         * @return input stream over compressed payload
         * @throws IOException if stream init fails
         */
        InputStream create() throws IOException;
    }

    private static class GZIPInputStreamWrapper implements InputStreamFactory {

View on GitHub (pinned to cf67b549a7)