{"record":{"id":"9b9fac308add31bb","repo":"phacility/phabricator","slug":"patch-generation-took-longer-than-configured-limit","errorCode":null,"errorMessage":"Patch generation took longer than configured limit (\"%s\") of %s second(s).","messagePattern":"Patch generation took longer than configured limit \\(\"(.+?)\"\\) of (.+?) second\\(s\\)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php","lineNumber":394,"sourceCode":"\n    $time_key = 'metamta.diffusion.time-limit';\n    $byte_key = 'metamta.diffusion.byte-limit';\n    $time_limit = PhabricatorEnv::getEnvConfig($time_key);\n    $byte_limit = PhabricatorEnv::getEnvConfig($byte_key);\n\n    $diff_info = DiffusionQuery::callConduitWithDiffusionRequest(\n      $viewer,\n      $drequest,\n      'diffusion.rawdiffquery',\n      array(\n        'commit' => $identifier,\n        'linesOfContext' => 3,\n        'timeout' => $time_limit,\n        'byteLimit' => $byte_limit,\n      ));\n\n    if ($diff_info['tooSlow']) {\n      throw new Exception(\n        pht(\n          'Patch generation took longer than configured limit (\"%s\") of '.\n          '%s second(s).',\n          $time_key,\n          new PhutilNumber($time_limit)));\n    }\n\n    if ($diff_info['tooHuge']) {\n      $pretty_limit = phutil_format_bytes($byte_limit);\n      throw new Exception(\n        pht(\n          'Patch size exceeds configured byte size limit (\"%s\") of %s.',\n          $byte_key,\n          $pretty_limit));\n    }\n\n    $file_phid = $diff_info['filePHID'];\n    $file = id(new PhabricatorFileQuery())","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php#L376-L412","documentation":"While publishing commit notifications, loadRawPatchText() calls diffusion.rawdiffquery with a timeout taken from the metamta.diffusion.time-limit config (PhabricatorRepositoryCommitPublishWorker.php:377-400). When generating the raw diff exceeds that many seconds, the conduit response sets tooSlow and the worker throws; the publish task then retries and keeps failing until the limit is raised or the diff becomes cheaper to compute.","triggerScenarios":"A commit whose raw diff (3 lines of context) takes longer than metamta.diffusion.time-limit seconds to generate: giant merges, huge tree rewrites, binary-heavy commits, or mirrors on slow network storage.","commonSituations":"Monorepos with enormous commits; default limits too tight for the repository's normal history; initial imports flooding the publish queue; slow I/O on the daemon host.","solutions":["Raise the limit: bin/config set metamta.diffusion.time-limit 120 (or whatever fits your largest commits)","Improve generation speed: faster storage for the repository working copies, reduce load on the VCS host","Re-run publishing for stuck commits after raising the limit: bin/repository reparse --message <monogram>"],"exampleFix":"# before\nbin/config set metamta.diffusion.time-limit 30\n\n# after\nbin/config set metamta.diffusion.time-limit 300","handlingStrategy":"retry","validationCode":"// Size the timeout before publishing: probe the repo's worst-case commit.\n// Raise the config to cover it:\n//   bin/config set metamta.diffusion.time-limit 300\n// Larger than the slowest 'git show'/'svn diff' of your biggest commit.","typeGuard":null,"tryCatchPattern":"try {\n  $patch = $this->loadRawPatchText($repository, $commit);\n} catch (Exception $ex) {\n  // tooSlow is transient for the task: after raising\n  // metamta.diffusion.time-limit, let the worker retry (it will), or\n  // manually requeue: bin/repository reparse --message <monogram>\n  phlog($ex);\n  throw $ex;\n}","preventionTips":["Set metamta.diffusion.time-limit above the slowest diff generation in your history (measure with git show on the largest commit)","Keep repository working copies on fast local storage","Watch the publish queue for repeated tooSlow failures after big merges"],"tags":["phabricator","email","diff-generation","timeout","configuration","php"],"backgroundTag":"operation-timeout","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}