alibaba/DataX · critical · IllegalArgumentException

通道容量[%d]必须大于0.

Error message

通道容量[%d]必须大于0.

What it means

Channel's constructor reads core.transport.channel.capacity (default 2048) and throws IllegalArgumentException if the value is <= 0. Capacity is the number of records the in-memory queue of the transfer channel may hold; zero/negative capacity would make producer/consumer blocking logic impossible, so it is rejected at construction.

Source

Thrown at core/src/main/java/com/alibaba/datax/core/transport/channel/Channel.java:60

    protected volatile long waitWriterTime = 0;

    private static Boolean isFirstPrint = true;

    private Communication currentCommunication;

    private Communication lastCommunication = new Communication();

    public Channel(final Configuration configuration) {
        //channel的queue里默认record为1万条。原来为512条
        int capacity = configuration.getInt(
                CoreConstant.DATAX_CORE_TRANSPORT_CHANNEL_CAPACITY, 2048);
        long byteSpeed = configuration.getLong(
                CoreConstant.DATAX_CORE_TRANSPORT_CHANNEL_SPEED_BYTE, 1024 * 1024);
        long recordSpeed = configuration.getLong(
                CoreConstant.DATAX_CORE_TRANSPORT_CHANNEL_SPEED_RECORD, 10000);

        if (capacity <= 0) {
            throw new IllegalArgumentException(String.format(
                    "通道容量[%d]必须大于0.", capacity));
        }

        synchronized (isFirstPrint) {
            if (isFirstPrint) {
                Channel.LOG.info("Channel set byte_speed_limit to " + byteSpeed
                        + (byteSpeed <= 0 ? ", No bps activated." : "."));
                Channel.LOG.info("Channel set record_speed_limit to " + recordSpeed
                        + (recordSpeed <= 0 ? ", No tps activated." : "."));
                isFirstPrint = false;
            }
        }

        this.taskGroupId = configuration.getInt(
                CoreConstant.DATAX_CORE_CONTAINER_TASKGROUP_ID);
        this.capacity = capacity;
        this.byteSpeed = byteSpeed;
        this.recordSpeed = recordSpeed;

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Set core.transport.channel.capacity to a positive value (default 2048; larger for wide records, smaller for memory pressure).
  2. If the intent was unlimited speed, leave capacity positive and set speed.byte/record to -1 or 0 instead.
  3. Validate job/core JSON before submitting: assert capacity > 0.

Example fix

// before (core.json)
"channel": { "capacity": 0 }

// after
"channel": { "capacity": 2048 }
Defensive patterns

Strategy: validation

Validate before calling

int capacity = configuration.getInt("core.transport.channel.capacity", 2048);
if (capacity <= 0) throw new IllegalArgumentException("channel capacity must be > 0, got " + capacity);

Prevention

When it happens

Trigger: Setting -Ddatax.core.transport.channel.capacity=0 or the equivalent key in core.json/job JSON to 0 or a negative number. Each task group constructs a Channel, so the job dies at startup, before any data moves.

Common situations: Users copy tuned core.json templates and set capacity to 0 to 'disable buffering'; env-var/JSON typos (e.g. "capacity": -1); someone confuses capacity with speed limits (byte/record speed, where <=0 means unlimited).

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/4df2c39774bbbdf3. Report an issue: GitHub.