{"record":{"id":"9ad89594313485af","repo":"apache/beam","slug":"gcthrashingpercentageperperiod-is-not-valid-value-not","errorCode":null,"errorMessage":"gcThrashingPercentagePerPeriod: {} is not valid value. Not starting MemoryMonitor.","messagePattern":"gcThrashingPercentagePerPeriod: (.+?) is not valid value\\. Not starting MemoryMonitor\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java","lineNumber":523,"sourceCode":"    File heapDumpFile = tryToDumpHeap();\n    LOG.error(\n        \"Shutting down JVM after {} consecutive periods of measured GC thrashing. \"\n            + \"Memory is {}. Heap dump {}.\",\n        thrashingCount,\n        describeMemory(),\n        heapDumpFile == null ? \"not written\" : (\"written to '\" + heapDumpFile + \"'\"));\n\n    System.exit(1);\n  }\n\n  /** Runs this thread. */\n  @Override\n  public void run() {\n    synchronized (waitingForStateChange) {\n      Preconditions.checkState(!isRunning.getAndSet(true), \"already running\");\n\n      if (this.gcThrashingPercentagePerPeriod <= 0 || this.gcThrashingPercentagePerPeriod >= 100) {\n        LOG.warn(\n            \"gcThrashingPercentagePerPeriod: {} is not valid value. Not starting MemoryMonitor.\",\n            this.gcThrashingPercentagePerPeriod);\n        isRunning.set(false);\n      }\n\n      waitingForStateChange.notifyAll();\n    }\n\n    // Within the memory monitor thread check to see if there is a pre-existing heap dump, and\n    // attempt to upload it. Note that this will delay the first memory monitor check.\n    tryUploadHeapDumpIfItExists();\n\n    try {\n      long lastTimeWokeUp = System.currentTimeMillis();\n      long lastLog = -1;\n      int currentThrashingCount = 0;\n      while (true) {\n        synchronized (waitingForStateChange) {","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java#L505-L541","documentation":"MemoryMonitor.run() validates gcThrashingPercentagePerPeriod and refuses to start the monitor if the value is <= 0 or >= 100, logging this warning and clearing the running flag. Consequently no GC-thrashing detection or memory monitoring occurs for the harness process. The threshold must be a percentage strictly between 0 and 100.","triggerScenarios":"The pipeline option supplying gcThrashingPercentagePerPeriod is set to 0, a negative number, 100, or higher — often via a misconfigured default or a template parameter injected as 0/blank-parsed value.","commonSituations":"Users disabling monitoring by setting the threshold to 0 (getting this warning instead), or YAML/JSON templates passing an unbounded value; copies of the option between runner-specific option classes carrying an invalid default.","solutions":["Set gcThrashingPercentagePerPeriod to a value in (0, 100), e.g. 75 or the Beam default (~80), in your pipeline options.","If you intended to disable the monitor, remove the option rather than passing 0, or accept that monitoring is off.","Check any pipeline template/parameter substitution that may inject an empty or 0 value for this option."],"exampleFix":"// before\n--gcThrashingPercentagePerPeriod=0\n// after\n--gcThrashingPercentagePerPeriod=75","handlingStrategy":"validation","validationCode":"int pct = options.getGcThrashingPercentagePerPeriod();\nif (pct <= 0 || pct >= 100) throw new IllegalArgumentException(\"gcThrashingPercentagePerPeriod must be in (0,100), got \" + pct);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate pipeline option values in launcher code before submission","Use the Beam default (~80) unless you have a specific reason","Guard template parameter substitution against blank/0 values"],"tags":["java","apache-beam","configuration","gc-thrashing"],"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"}