PAC-E007 · evaluation-timeout

Evaluation did not finish within the time limit

critical · Errors and robustness

A test evaluation ran into the sandbox timeout. Real engines have no comparable guard; a loop that never ends hangs proxy resolution for the browser.

Why it matters

Browsers evaluate the PAC for every connection on a dedicated resolver thread. A loop that never terminates (or a pathological regular expression) blocks that thread. Requests queue behind it and the browser appears to hang on “resolving proxy”. There is no recovery other than restarting the browser or changing the PAC. Windows (WinHTTP) showed no time limit in the lab either (2026-10-11): an endless loop blocked the calling program for more than 18 minutes. Nothing in the PAC function model needs loops that depend on external state; every loop should iterate over a fixed list.

How to fix

Remove the loop or make it iterate over a bounded array; never loop on a condition that the loop body does not change.

Examples

Bad

function FindProxyForURL(url, host) {
  var i = 0;
  while (i < 10) {
    if (shExpMatch(host, "*.corp.example")) {
      return "DIRECT";
    }
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

var directPatterns = ["*.corp.example", "*.test"];
function FindProxyForURL(url, host) {
  for (var i = 0; i < directPatterns.length; i++) {
    if (shExpMatch(host, directPatterns[i])) {
      return "DIRECT";
    }
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

The bad example never increments i.

Engine behaviour

EngineBehaviourSource
winhttpNo time limit was observed: a script with an endless loop blocked the calling program for more than 18 minutes, and the script kept running after that program was ended. No memory limit was observed either: a script that kept allocating memory grew to 2.9 GiB.lab, verified 2026-10-11

Source: code = read in the engine's source, doc = vendor documentation, lab = observed in a lab run, expert = practitioner knowledge, not yet verified.

Related rules

Last updated: