{"record":{"id":"6effb8f92199af94","repo":"apache/cassandra","slug":"to-be-able-to-set-enable-user-defined-functions-th","errorCode":null,"errorMessage":"To be able to set enable_user_defined_functions_threads: false you need to set allow_insecure_udfs: true - this is an unsafe configuration and is not recommended.","messagePattern":"To be able to set enable_user_defined_functions_threads: false you need to set allow_insecure_udfs: true - this is an unsafe configuration and is not recommended\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1113,"sourceCode":"        conf.counter_cache_size = new DataStorageSpec.LongMebibytesBound(counterCacheSizeInMiB);\n\n        // if set to empty/\"auto\" then use 5% of Heap size\n        indexSummaryCapacityInMiB = (conf.index_summary_capacity == null)\n                                    ? Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.05 / 1024 / 1024))\n                                    : conf.index_summary_capacity.toMebibytes();\n\n        if (indexSummaryCapacityInMiB < 0)\n            throw new ConfigurationException(\"index_summary_capacity option was set incorrectly to '\"\n                                             + conf.index_summary_capacity.toString() + \"', it should be a non-negative integer.\", false);\n\n        // we need this assignment for the Settings virtual table - CASSANDRA-17735\n        conf.index_summary_capacity = new DataStorageSpec.LongMebibytesBound(indexSummaryCapacityInMiB);\n\n        if (conf.user_defined_functions_fail_timeout.toMilliseconds() < conf.user_defined_functions_warn_timeout.toMilliseconds())\n            throw new ConfigurationException(\"user_defined_functions_warn_timeout must less than user_defined_function_fail_timeout\", false);\n\n        if (!conf.allow_insecure_udfs && !conf.user_defined_functions_threads_enabled)\n            throw new ConfigurationException(\"To be able to set enable_user_defined_functions_threads: false you need to set allow_insecure_udfs: true - this is an unsafe configuration and is not recommended.\");\n\n        if (conf.allow_extra_insecure_udfs)\n            logger.warn(\"Allowing java.lang.System.* access in UDFs is dangerous and not recommended. Set allow_extra_insecure_udfs: false to disable.\");\n\n        if (conf.scripted_user_defined_functions_enabled)\n            throw new ConfigurationException(\"JavaScript user-defined functions were removed in CASSANDRA-18252. \" +\n                                             \"Hooks are planned to be introduced as part of CASSANDRA-17280\");\n\n        if (conf.commitlog_segment_size.toMebibytes() == 0)\n            throw new ConfigurationException(\"commitlog_segment_size must be positive, but was \"\n                                             + conf.commitlog_segment_size.toString(), false);\n        else if (conf.commitlog_segment_size.toMebibytes() >= 2048)\n            throw new ConfigurationException(\"commitlog_segment_size must be smaller than 2048, but was \"\n                                             + conf.commitlog_segment_size.toString(), false);\n\n        if (conf.max_mutation_size == null)\n            conf.max_mutation_size = new DataStorageSpec.IntKibibytesBound(conf.commitlog_segment_size.toKibibytes() / 2);\n        else if (conf.commitlog_segment_size.toKibibytes() < 2 * conf.max_mutation_size.toKibibytes())","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1095-L1131","documentation":"Thrown when enable_user_defined_functions_threads is set to false without allow_insecure_udfs: true. Single-threaded UDF execution is only permitted in insecure mode because UDFs can then block or escape the runtime guarantees Cassandra makes; the combination without allow_insecure_udfs is rejected at startup.","triggerScenarios":"cassandra.yaml contains enable_user_defined_functions_threads: false and allow_insecure_udfs: false (or unset).","commonSituations":"Operators trying to reduce UDF thread overhead disable threading; copying old pre-CASSANDRA config samples where the security flag coupling did not exist.","solutions":["Re-enable UDF threads (user_defined_functions_threads_enabled: true), the recommended configuration.","Or explicitly accept the risk by setting allow_insecure_udfs: true alongside threads: false.","Restart the node after changing either setting."],"exampleFix":"# before\nenable_user_defined_functions_threads: false\n# after (option A, recommended)\nenable_user_defined_functions_threads: true\n# after (option B, insecure)\nenable_user_defined_functions_threads: false\nallow_insecure_udfs: true","handlingStrategy":"validation","validationCode":"boolean threads = (boolean) yaml.getOrDefault(\"user_defined_functions_threads_enabled\", true);\nboolean insecure = (boolean) yaml.getOrDefault(\"allow_insecure_udfs\", false);\nif (!threads && !insecure)\n    throw new IllegalArgumentException(\"Disabling UDF threads requires allow_insecure_udfs: true\");","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.applySimpleConfig();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"enable_user_defined_functions_threads\"))\n        logger.error(\"Re-enable UDF threads or set allow_insecure_udfs: true\");\n}","preventionTips":["Keep user_defined_functions_threads_enabled at its default (true)","Never disable UDF threading unless you fully accept the security implications","Grep config templates for legacy enable_user_defined_functions_threads keys"],"tags":["config","udf","security"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}