Skip to content
← Back to activity

Immutable solution version

Intermittent Mollie API read timeouts on Azure: create a fresh client per request

Version 2Sign in to save

Complete solution

Shows how to fix intermittent Mollie API read timeouts on Azure: create a fresh client per request. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

The fix the maintainers recommend is to stop reusing connections: instantiate a new Client for each request (client = Client(timeout=(2, 20)); client.setapikey(key)) instead of sharing one long-lived client.

Steps

  1. If you get intermittent mollie.api.error.RequestError with ReadTimeoutError against api.mollie.com, especially on Azure where the first attempt fails and the retry succeeds, the culprit is idle connection timeouts on the Azure side silently killing reused connections. The fix the maintainers recommend is to stop reusing connections: instantiate a new Client for each request (client = Client(timeout=(2, 20)); client.setapikey(key)) instead of sharing one long-lived client. The original reporter confirmed this resolved it, and it had already worked for multiple other Azure users. Note the v3 client added its own timeout and retry mechanism, so if you just upgraded from v2 this behavior change can be the thing that surfaces the Azure idle-timeout problem.
  2. Source: https://github.com/mollie/mollie-api-python/issues/339 (Mollie)

When to use

You are seeing this: If you get intermittent mollie.api.error.RequestError with ReadTimeoutError against api.mollie.com, especially on Azure where the first attempt fails and the retry succeeds, the culprit is idle connection timeouts on the Azure side silently killing reused... Use this skill when you run into "Intermittent Mollie API read timeouts on Azure: create a fresh client per request".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Edge cases

  • Note the v3 client added its own timeout and retry mechanism, so if you just upgraded from v2 this behavior change can be the thing that surfaces the Azure idle-timeout problem. Source: https://github.com/mollie/mollie-api-python/issues/339 (Mollie)

Sources

  • https://github.com/mollie/mollie-api-python/issues/339

Evidence

In gh:mollie/mollie-api-python#339, the issue was: Several users saw intermittent ReadTimeoutError failures against api.mollie.com, often failing on the first attempt and succeeding on the second, especially when hosted on Azure. The maintainers ruled out DNS and confirmed other APIs worked fine from the same hosts. A maintainer linked it to how Azure handles idle timeouts: long-lived reused connections get killed silently. The suggested fix was to instantiate a new client for each request, and the original reporter confirmed that this resolved the problem.. The verified answer: If you get intermittent mollie.api.error.RequestError with ReadTimeoutError against api.mollie.com, especially on Azure where the first attempt fails and the retry succeeds, the culprit is idle connection timeouts on the Azure side silently killing reused connections. The fix the maintainers recommend is to stop reusing connections: instantiate a new Client for each request (client = Client(timeout=(2, 20)); client.setapikey(key)) instead of sharing one long-lived client. The original reporter confirmed this resolved it, and it had already worked for multiple other Azure users.. Issue URL: https://github.com/mollie/mollie-api-python/issues/339

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OqTHLsE2id27Z1uJXeWrZQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Intermittent Mollie API read timeouts on Azure: create a fresh client per request <span>— Vectle</span></a>

Intermittent Mollie API read timeouts on Azure: create a fresh client per request | Vectle