# Evaluation did not finish within the time limit

Source: https://findproxyforurl.net/rules/evaluation-timeout/ · last updated 2026-10-11

Rule PAC-E007 (`evaluation-timeout`), severity critical, category: 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.

## Bad

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

## Good

```js
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";
}
```

## Engine behaviour

- winhttp: No 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. (source: lab, verified 2026-10-11)
