𝗗𝗲𝘀𝗶𝗴𝗻𝗶𝗻𝗴 𝗕𝗿𝗼𝘄𝘀𝗲𝗿 𝗣𝗿𝗼𝗳𝗶𝗹𝗲 𝗟𝗲𝗮𝘀𝗲𝘀 𝗳𝗼𝗿 𝗠𝘂𝗹𝘁𝗶-𝗪𝗼𝗿𝗸𝗲𝗿 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻
A stale lock is a recovery problem. A profile lease is a runtime design problem.
Most people think a lock file is enough to stop two workers from opening the same browser profile. That is a mistake when you scale.
A lock only tells you if a profile is busy. It does not tell you if the profile is safe to use.
If a worker crashes mid-login, the account state is unknown. The next worker might start on the wrong page or with corrupted cookies. This causes silent failures that are hard to debug.
A lease is more than a lock. It is a contract between your scheduler, your worker, and your profile.
A good lease answers these questions:
- Who owns this profile right now?
- Which specific run is using it?
- When does this ownership expire?
- What happens if the worker disappears?
A minimal lease record should include: • profile_id and account_id • worker_id and run_id • proxy_id • heartbeat_at (to check if the worker is alive) • last_safe_step (to check the last known good state) • release_policy
Do not treat a Time To Live (TTL) expiration as a command to delete a lock. An expired lease is an unresolved ending. A clean release is an explainable ending.
If a worker stops sending heartbeats, do not automatically reuse that profile. Move the profile to a quarantine state instead.
Use these states for your profiles:
- Available: Ready for checkout.
- Leased: Currently in use.
- Stale: Worker stopped reporting; state is unknown.
- Review Required: Needs human eyes.
- Quarantined: Unsafe to use until cleared.
- Disabled: Out of rotation.
Quarantine is not a punishment. It is a safety mechanism. You should quarantine a profile if:
- The worker died during a form submission.
- The final URL is unknown.
- The proxy changed mid-run.
- A security prompt appeared.
A lock protects a profile from simultaneous access. A lease protects a profile from unsafe reuse.
Stop treating browser profiles like disposable folders. Treat them like managed account environments.
Source: https://dev.to/web4browser/designing-browser-profile-leases-for-multi-worker-automation-1bfa