{"record":{"id":"b25c79e758fd3452","repo":"apache/beam","slug":"max-time-between-dumps-v-should-be-greater-than-or-equal-to","errorCode":null,"errorMessage":"max time between dumps %v should be greater than or equal to sampling frequence %v","messagePattern":"max time between dumps (.+?) should be greater than or equal to sampling frequence (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/util/harnessopts/heap_dump.go","lineNumber":35,"sourceCode":"\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/core/util/hooks\"\n)\n\nconst (\n\tdiagnosticsHook = \"beam:go:hook:diagnostics:heapDump\"\n)\n\n// HeapDumpFrequency sets the sampling frequency for how often the diagnostics service checks if it\n// should take a heap dump and the maximum allowable time between heap dumps.\n// Setting the sampling frequency to <=0 disables the heap dump checks.\n// The default value for the sampling frequency is 1 second, the default max time is 60 seconds.\nfunc HeapDumpFrequency(samplingFrequencySeconds, maxTimeBetweenDumpsSeconds int) error {\n\tif maxTimeBetweenDumpsSeconds < samplingFrequencySeconds {\n\t\treturn fmt.Errorf(\"max time between dumps %v should be greater than or equal to sampling frequence %v\", maxTimeBetweenDumpsSeconds, samplingFrequencySeconds)\n\t}\n\t// The hook itself is defined in beam/core/runtime/harness/init/diagnostics_hook.go\n\treturn hooks.EnableHook(diagnosticsHook, strconv.Itoa(samplingFrequencySeconds), strconv.Itoa(maxTimeBetweenDumpsSeconds))\n}\n","sourceCodeStart":17,"sourceCodeEnd":40,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/util/harnessopts/heap_dump.go#L17-L40","documentation":"HeapDumpFrequency configures the diagnostics service's heap-dump sampling frequency and the maximum time between dumps. This error means the caller passed a maxTimeBetweenDumpsSeconds that is smaller than samplingFrequencySeconds, which is nonsensical: dumps would have to happen more often than the sampler checks. The library rejects the configuration before enabling the hook.","triggerScenarios":"Calling beam HarnessOpts HeapDumpFrequency(samplingFrequencySeconds, maxTimeBetweenDumpsSeconds) with maxTimeBetweenDumpsSeconds < samplingFrequencySeconds, e.g. HeapDumpFrequency(5, 1).","commonSituations":"Developers misread the parameter order and swap the two values, or tune the sampling frequency up after setting a small max-dump interval without revisiting the other knob.","solutions":["Ensure maxTimeBetweenDumpsSeconds >= samplingFrequencySeconds in the call.","Check argument order; the first parameter is the sampling frequency, the second is the max time between dumps.","If you want dumps no more often than every N seconds, set maxTimeBetweenDumpsSeconds = N and samplingFrequencySeconds <= N."],"exampleFix":"// before\nHeapDumpFrequency(5, 2)\n// after\nHeapDumpFrequency(2, 5)","handlingStrategy":"validation","validationCode":"func validDumpConfig(freq, maxTime int) bool { return maxTime >= freq }","typeGuard":null,"tryCatchPattern":"if err := harnessopts.HeapDumpFrequency(freq, maxTime); err != nil { log.Fatalf(\"heap dump config rejected: %v\", err) }","preventionTips":["Keep samplingFrequencySeconds <= maxTimeBetweenDumpsSeconds by construction (e.g. derive one from the other).","Validate both knobs in your config loader before enabling diagnostics."],"tags":["go","configuration","beam"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}