Knowledge base

retry-attempts

<proxy>

How many times to try this proxy before moving on to the next one
in the configuration this is a lineretry-attempts 1inside the block <proxy>
When to give up and take the next one

The proxy list in use-proxy is a chain of backups: the second is taken only when the first did not respond. The line sets how many times to try before moving on to the next. The default is 1, the ceiling is 10.

The default means “one attempt and move on.” Instant switching is good when the proxy has really gone down, and bad when it has just blinked: the queue will move to the backup and stay there until the backup fails.

The price of waiting is delivery delay. Each failed attempt takes time; ten attempts to a proxy that is down will delay messages for all that time instead of taking a live one right away.

The line is per proxy, not per list. Each block can have its own number: more for a reliable primary, fewer for a backup.

The main trap is raising the number by mistaking a “blink” for the rule. If the proxy goes down regularly, it is the proxy that needs fixing. A higher number of attempts only lengthens the delay in each such case and makes switching to the backup uselessly slow.
What the Hub does. It does not write it: there are no <proxy> blocks in the configuration, and a sending address has no spare proxy either — there is nothing to switch to. The queue handles a connection failure to the gate with ordinary retries.
Recommended values

The choice depends on how the proxy behaves on failure:

Value When
1 (default) the proxy is either alive or dead for a long time
2–3 the proxy restarts in seconds
closer to 10 almost never: the delay grows linearly
The default of 1, the range from 1 to 10 and the rule for moving on to the next proxy come from the manual (§ 3.3.22.5, § 3.3.1.47). The advice to match it with the restart time is ours.
Example configuration
# the proxy restarts in seconds — we give it three attempts
<proxy mta-proxy>
    server proxy.internal:9999
    client 16.80.77.101  client2.hostname.com
    retry-attempts 3</proxy>
For the backup proxy the number is usually left at one: it is last in the chain anyway.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
▲

Common mistakes and problems

what people get wrong and how it ends1 mistake▶

Raising the number of attempts instead of fixing the proxy

our experience

What it costsEach failed attempt takes time. With a high number of attempts, a proxy that regularly goes down delays delivery every time instead of giving way to a live one right away.
How to spot itDelivery delays grow in waves that coincide with proxy restarts.
How to do it rightKeep one or two attempts and deal with the proxy itself.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
Reference data
Syntax
retry-attempts <integer>
Values
an integer from 1 to 10
Default
1 § 3.3.22.5
Applying
reload, no restart needed
Queue
will not touch what is already queued
Where to write it
<proxy>
How many times
once in the block
Everything here comes from the manual, with the section.
Inheritance
There is no inheritance: the line lives inside its <proxy> and concerns attempts only to that proxy. The order of trying is set not here but by the list in use-proxy.
How to check on the node
Which proxy a message left through shows in the proxy columns of accounting — first find their numbers:
head -1 "$(ls -t /var/log/pmta/acct-*.csv | head -1)" | tr -d '\r' | tr ',' '\n' | grep -n '^dlvProxy'
The line number is the column number: lines are parsed by it, for example cut -d, -f1,N. Empty means the dlvProxy… fields are not selected in record-fields, and proxies are not visible in accounting. Constant work through the backup proxy means the primary one is unavailable.
In the Hub
Cost of a mistake
disruptive: applying it interrupts the node
Scenarios
Sending through proxies