{"record":{"id":"569498c2b76d24e1","repo":"alibaba/nacos","slug":"servicestatussynchronizationperiodmillis-is-too-sm","errorCode":null,"errorMessage":"serviceStatusSynchronizationPeriodMillis is too small(<5000)","messagePattern":"serviceStatusSynchronizationPeriodMillis is too small\\(<5000\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":207,"sourceCode":"                boolean enabled = Boolean.parseBoolean(value);\n                tempSwitchDomain.setDistroEnabled(enabled);\n            }\n            \n            if (entry.equals(SwitchEntry.CHECK) || entry.equals(SwitchEntry.HEALTH_CHECK_ENABLED)) {\n                boolean enabled = Boolean.parseBoolean(value);\n                tempSwitchDomain.setHealthCheckEnabled(enabled);\n            }\n            \n            if (entry.equals(SwitchEntry.PUSH_ENABLED)) {\n                boolean enabled = Boolean.parseBoolean(value);\n                tempSwitchDomain.setPushEnabled(enabled);\n            }\n            \n            if (entry.equals(SwitchEntry.SERVICE_STATUS_SYNC_PERIOD)) {\n                long millis = Long.parseLong(value);\n                \n                if (millis < SwitchEntry.MIN_SERVICE_SYNC_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"serviceStatusSynchronizationPeriodMillis is too small(<5000)\");\n                }\n                \n                tempSwitchDomain.setServiceStatusSynchronizationPeriodMillis(millis);\n            }\n            \n            if (entry.equals(SwitchEntry.SERVER_STATUS_SYNC_PERIOD)) {\n                long millis = Long.parseLong(value);\n                \n                if (millis < SwitchEntry.MIN_SERVER_SYNC_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"serverStatusSynchronizationPeriodMillis is too small(<15000)\");\n                }\n                \n                tempSwitchDomain.setServerStatusSynchronizationPeriodMillis(millis);\n            }\n            \n            if (entry.equals(SwitchEntry.HEALTH_CHECK_TIMES)) {","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L189-L225","documentation":"Thrown when entry is 'serviceStatusSynchronizationPeriodMillis' and the parsed long is below MIN_SERVICE_SYNC_TIME_MIILIS (5000 ms). This controls how frequently service status is synchronized across the Distro cluster; too-frequent sync would overload inter-node communication.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=serviceStatusSynchronizationPeriodMillis and value < 5000, e.g. value=3000, value=1000.","commonSituations":"Passing seconds instead of milliseconds, or attempting aggressive cluster sync tuning below the 5-second minimum.","solutions":["Set serviceStatusSynchronizationPeriodMillis to >= 5000 (5 seconds).","Confirm the value is in milliseconds."],"exampleFix":"// before\nPUT /v3/admin/ns/operator/switches?entry=serviceStatusSynchronizationPeriodMillis&value=3000\n// after\nPUT /v3/admin/ns/operator/switches?entry=serviceStatusSynchronizationPeriodMillis&value=5000","handlingStrategy":"validation","validationCode":"long millis = Long.parseLong(value);\nif (millis < 5000) {\n    throw new IllegalArgumentException(\"serviceStatusSyncPeriod must be >= 5000\");\n}","typeGuard":"function isValidServiceStatusSyncPeriod(v: number): boolean {\n  return v >= 5000;\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(\"serviceStatusSynchronizationPeriodMillis\", String.valueOf(millis), debug);\n} catch (NacosApiException e) {\n  if (e.getMessage().contains(\"too small\")) {\n    millis = 5000;\n  }\n}","preventionTips":["Pass milliseconds, not seconds.","Do not go below the 5-second Distro sync floor."],"tags":["naming","switch","validation","distro-sync"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}