{"record":{"id":"7bae25ac94fe7435","repo":"grpc/grpc-go","slug":"max-ring-size-value-of-d-is-greater-than-max-supp","errorCode":null,"errorMessage":"max_ring_size value of %d is greater than max supported value %d for this field","messagePattern":"max_ring_size value of (.+?) is greater than max supported value (.+?) for this field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"balancer/ringhash/config.go","lineNumber":46,"sourceCode":"\tiringhash \"google.golang.org/grpc/internal/ringhash\"\n)\n\nconst (\n\tdefaultMinSize         = 1024\n\tdefaultMaxSize         = 4096\n\tringHashSizeUpperBound = 8 * 1024 * 1024 // 8M\n)\n\nfunc parseConfig(c json.RawMessage) (*iringhash.LBConfig, error) {\n\tvar cfg iringhash.LBConfig\n\tif err := json.Unmarshal(c, &cfg); err != nil {\n\t\treturn nil, err\n\t}\n\tif cfg.MinRingSize > ringHashSizeUpperBound {\n\t\treturn nil, fmt.Errorf(\"min_ring_size value of %d is greater than max supported value %d for this field\", cfg.MinRingSize, ringHashSizeUpperBound)\n\t}\n\tif cfg.MaxRingSize > ringHashSizeUpperBound {\n\t\treturn nil, fmt.Errorf(\"max_ring_size value of %d is greater than max supported value %d for this field\", cfg.MaxRingSize, ringHashSizeUpperBound)\n\t}\n\tif cfg.MinRingSize == 0 {\n\t\tcfg.MinRingSize = defaultMinSize\n\t}\n\tif cfg.MaxRingSize == 0 {\n\t\tcfg.MaxRingSize = defaultMaxSize\n\t}\n\tif cfg.MinRingSize > cfg.MaxRingSize {\n\t\treturn nil, fmt.Errorf(\"min %v is greater than max %v\", cfg.MinRingSize, cfg.MaxRingSize)\n\t}\n\tif cfg.MinRingSize > envconfig.RingHashCap {\n\t\tcfg.MinRingSize = envconfig.RingHashCap\n\t}\n\tif cfg.MaxRingSize > envconfig.RingHashCap {\n\t\tcfg.MaxRingSize = envconfig.RingHashCap\n\t}\n\tif !envconfig.RingHashSetRequestHashKey {\n\t\tcfg.RequestHashHeader = \"\"","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/ringhash/config.go#L28-L64","documentation":"Returned by ringhash's parseConfig() (balancer/ringhash/config.go:46) when MaxRingSize exceeds ringHashSizeUpperBound (8388608). Same memory-safety cap as minRingSize. maxRingSize bounds the largest the hash ring can grow; exceeding 8M entries is rejected.","triggerScenarios":"The ring_hash_experimental config sets maxRingSize to a value > 8388608. The check at line 45 fails.","commonSituations":"xDS control plane pushes an oversized maxRingSize; operator sets a huge value for finer-grained hashing; a config typo.","solutions":["Set maxRingSize to a value <= 8388608 (8M).","Use the default (defaultMaxSize = 4096) for most deployments.","Ensure minRingSize <= maxRingSize after capping."],"exampleFix":"// before: maxRingSize beyond the hard cap\ngrpc.WithDefaultServiceConfig(`{\"loadBalancingConfig\":[{\"ring_hash_experimental\":{\"maxRingSize\":16000000}}]}`)\n\n// after: within the supported range\ngrpc.WithDefaultServiceConfig(`{\"loadBalancingConfig\":[{\"ring_hash_experimental\":{\"minRingSize\":1024,\"maxRingSize\":4096}}]}`)","handlingStrategy":"validation","validationCode":"const ringHashUpperBound = 8 * 1024 * 1024\nfunc validateMaxRingSize(max uint64) error {\n    if max > ringHashUpperBound {\n        return fmt.Errorf(\"maxRingSize %d exceeds max %d\", max, ringHashUpperBound)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap maxRingSize at 8388608 in config generation.","Use the default (4096) for most workloads."],"tags":["grpc","balancer","ringhash","config","validation","ring-size"],"backgroundTag":null,"analyzedSha":"0c51461d27177d997e14c642fe18c11668fc09a3","analyzedAt":"2026-08-11T14:49:15.055Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}