{"record":{"id":"82d0010d01d897f7","repo":"grpc/grpc-go","slug":"min-ring-size-value-of-d-is-greater-than-max-supp","errorCode":null,"errorMessage":"min_ring_size value of %d is greater than max supported value %d for this field","messagePattern":"min_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":43,"sourceCode":"\n\t\"google.golang.org/grpc/internal/envconfig\"\n\t\"google.golang.org/grpc/internal/metadata\"\n\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","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/grpc/grpc-go/blob/0c51461d27177d997e14c642fe18c11668fc09a3/balancer/ringhash/config.go#L25-L61","documentation":"Returned by ringhash's parseConfig() (balancer/ringhash/config.go:43) when MinRingSize exceeds ringHashSizeUpperBound (8 * 1024 * 1024 = 8388608). The ring is an in-memory hash ring of SubConn entries; an enormous ring would consume excessive memory, so it is hard-capped at 8M entries.","triggerScenarios":"The ring_hash_experimental config sets minRingSize to a value > 8388608. json.Unmarshal succeeds, then the check at line 42 fails.","commonSituations":"A very large minRingSize requested (e.g. from an xDS control plane) to maximize distribution accuracy without understanding the memory cost; a config typo adding extra zeros.","solutions":["Set minRingSize to a value <= 8388608 (8M).","Use the defaults (defaultMinSize = 1024) unless you have a measured need for more.","Prefer maxRingSize tuning over inflating minRingSize."],"exampleFix":"// before: minRingSize beyond the hard cap\ngrpc.WithDefaultServiceConfig(`{\"loadBalancingConfig\":[{\"ring_hash_experimental\":{\"minRingSize\":100000000}}]}`)\n\n// after: within the supported range (or omit for default 1024)\ngrpc.WithDefaultServiceConfig(`{\"loadBalancingConfig\":[{\"ring_hash_experimental\":{\"minRingSize\":1024,\"maxRingSize\":4096}}]}`)","handlingStrategy":"validation","validationCode":"const ringHashUpperBound = 8 * 1024 * 1024\nfunc validateMinRingSize(min uint64) error {\n    if min > ringHashUpperBound {\n        return fmt.Errorf(\"minRingSize %d exceeds max %d\", min, ringHashUpperBound)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cap minRingSize at 8388608 in config generation / xDS policy validators.","Prefer defaults unless you have measured the need for a larger ring."],"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"}