{"record":{"id":"7a81eeb1ca5db107","repo":"apache/hadoop","slug":"ns-ipc-callqueue-wrrmux-weights-key-mu","errorCode":null,"errorMessage":"ns + \".\" + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY + \" must specify exactly \" + this.numQueues + \" weights: one for each priority level.\"","messagePattern":"ns \\+ \"\\.\" \\+ IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY \\+ \" must specify exactly \" \\+ this\\.numQueues \\+ \" weights: one for each priority level\\.\"","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WeightedRoundRobinMultiplexer.java","lineNumber":70,"sourceCode":"  private final AtomicInteger requestsLeft; // Number of requests left for this queue\n\n  private int[] queueWeights; // The weights for each queue\n\n  public WeightedRoundRobinMultiplexer(int aNumQueues, String ns,\n    Configuration conf) {\n    if (aNumQueues <= 0) {\n      throw new IllegalArgumentException(\"Requested queues (\" + aNumQueues +\n        \") must be greater than zero.\");\n    }\n\n    this.numQueues = aNumQueues;\n    this.queueWeights = conf.getInts(ns + \".\" +\n      IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY);\n\n    if (this.queueWeights.length == 0) {\n      this.queueWeights = getDefaultQueueWeights(this.numQueues);\n    } else if (this.queueWeights.length != this.numQueues) {\n      throw new IllegalArgumentException(ns + \".\" +\n        IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY + \" must specify exactly \" +\n        this.numQueues + \" weights: one for each priority level.\");\n    }\n\n    this.currentQueueIndex = new AtomicInteger(0);\n    this.requestsLeft = new AtomicInteger(this.queueWeights[0]);\n\n    LOG.info(\"WeightedRoundRobinMultiplexer is being used.\");\n  }\n\n  /**\n   * Creates default weights for each queue. The weights are 2^N.\n   */\n  private int[] getDefaultQueueWeights(int aNumQueues) {\n    int[] weights = new int[aNumQueues];\n\n    int weight = 1; // Start low\n    for(int i = aNumQueues - 1; i >= 0; i--) { // Start at lowest queue","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/WeightedRoundRobinMultiplexer.java#L52-L88","documentation":"When ipc.<port>.callqueue.faircallqueue.multiplexer.weights (ns + '.' + IPC_CALLQUEUE_WRRMUX_WEIGHTS_KEY) is set, the number of comma-separated integers must exactly equal the number of priority queues — one weight per queue. If the counts differ, the constructor throws IllegalArgumentException and the server fails to start. When the key is unset, defaults (powers of two, 2^N) are generated automatically.","triggerScenarios":"Setting ipc.8020.callqueue.faircallqueue.multiplexer.weights=9,4,1 while priority-levels is 2 or 4 (count mismatch); editing priority-levels without updating the weights list; extra trailing comma producing an unexpected parsed entry.","commonSituations":"Call-queue tuning changes where operators change the number of queues but leave the old weights array; copy-pasted configs between services with different port namespaces and different queue counts.","solutions":["Count your priority levels and provide exactly that many weights, e.g. for 3 queues: ipc.8020.callqueue.faircallqueue.multiplexer.weights=9,4,1.","Or delete the weights key entirely to accept the default 2^N weights.","Re-check the value after any change to priority-levels / scheduler priority-levels — the two settings must move together."],"exampleFix":"# before (3 weights but 4 priority levels)\nipc.8020.callqueue.priority-levels=4\nipc.8020.callqueue.faircallqueue.multiplexer.weights=9,4,1\n\n# after\nipc.8020.callqueue.priority-levels=3\nipc.8020.callqueue.faircallqueue.multiplexer.weights=9,4,1","handlingStrategy":"validation","validationCode":"int levels = conf.getInt(\"ipc.\" + port + \".callqueue.priority-levels\", 4);\nint[] weights = conf.getInts(\"ipc.\" + port + \".callqueue.faircallqueue.multiplexer.weights\");\nif (weights.length != 0 && weights.length != levels) {\n  throw new IllegalArgumentException(\"weights count \" + weights.length\n      + \" != priority levels \" + levels + \"; fix config before starting server\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat priority-levels and faircallqueue.multiplexer.weights as one unit: change both or neither (omit weights to get 2^N defaults).","Add a config linter rule that cross-checks array-length vs level-count for ipc.* keys.","Test call-queue changes on a staging daemon before fleet rollout — these errors abort startup."],"tags":["hadoop","ipc","call-queue","faircallqueue","configuration","weights"],"backgroundTag":"config-array-length-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}