{"record":{"id":"ba8db563f3f2e5d7","repo":"apache/druid","slug":"invalid-value-of-s-maxthreads-d","errorCode":null,"errorMessage":"Invalid value of %s.maxThreads[%d]","messagePattern":"Invalid value of (.+?)\\.maxThreads\\[(.+?)\\]","errorType":"validation","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"multi-stage-query/src/main/java/org/apache/druid/msq/guice/PeonMemoryManagementModule.java","lineNumber":107,"sourceCode":"  )\n  {\n    return new PeonProcessingBuffersProvider(\n        processingPool,\n        memoryIntrospector.numProcessingThreads()\n    );\n  }\n\n  public static int getNumThreads(\n      final TaskMemoryManagementConfig taskMemoryManagementConfig,\n      final DruidProcessingConfig processingConfig\n  )\n  {\n    if (taskMemoryManagementConfig.getMaxThreads() == TaskMemoryManagementConfig.UNLIMITED) {\n      return processingConfig.getNumThreads();\n    } else if (taskMemoryManagementConfig.getMaxThreads() > 0) {\n      return Math.min(taskMemoryManagementConfig.getMaxThreads(), processingConfig.getNumThreads());\n    } else {\n      throw new IAE(\n          \"Invalid value of %s.maxThreads[%d]\",\n          TaskMemoryManagementConfig.BASE_PROPERTY,\n          taskMemoryManagementConfig.getMaxThreads()\n      );\n    }\n  }\n}\n","sourceCodeStart":89,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/multi-stage-query/src/main/java/org/apache/druid/msq/guice/PeonMemoryManagementModule.java#L89-L115","documentation":"PeonMemoryManagementModule.getNumThreads validates druid.task.memory-management.maxThreads: only UNLIMITED (-1) or a positive integer is allowed; any other value (e.g. 0 or negative) throws IllegalArgumentException \"Invalid value of %s.maxThreads[%d]\" while creating the memory introspector at peon startup.","triggerScenarios":"druid.task.memory-management.maxThreads set to 0 or a negative number other than the UNLIMITED sentinel in runtime.properties or task context; typo in sentinel value after config refactor.","commonSituations":"Copy-pasting example configs that use 0 for 'unlimited' (Druid uses -1/UNLIMITED); provisioning scripts generating maxThreads from an empty or invalid variable; mixing versions where the sentinel semantics differ.","solutions":["Set druid.task.memory-management.maxThreads to a positive integer","Remove the property entirely or set it to -1 (TaskMemoryManagementConfig.UNLIMITED) to follow druid.processing.numThreads","Fix config-generation scripts to emit -1 instead of 0 for unlimited"],"exampleFix":"// before (runtime.properties)\ndruid.task.memory-management.maxThreads=0\n// after\ndruid.task.memory-management.maxThreads=-1","handlingStrategy":"validation","validationCode":"int v = taskMemoryManagementConfig.getMaxThreads();\nif (v != TaskMemoryManagementConfig.UNLIMITED && v <= 0) {\n  throw new IllegalArgumentException(\"druid.task.memory-management.maxThreads must be positive or -1\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use -1 (not 0) for unlimited when templating configs","Validate generated runtime.properties in CI","Document the sentinel value for operators"],"tags":["msq","configuration","invalid-value"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}