skip to content

A tunnel to a browser provider outlived the job that started it — what does that cost the next run?

level: middleimportance: nice to knowfreq 52%

answer

  1. teardown did not run
  2. the route outlives the job
  3. harm depends on who can name it
  4. a reusable name is the hazard
  5. reconcile what is up against what should be

basics

~20 s

A leftover tunnel costs the next run only when that run can name it: a reusable name lets a later job attach to a dead run's route, reach whatever that job pointed at, and pass against the wrong target.

solid answer

~50 s

Whether it harms the next run depends entirely on **naming**. If tunnel names are unique per job, a leftover is a standing route nobody will ever ask for — worth finding and stopping, but not a correctness problem. If the name is reusable, the next job asking for it attaches to a route the previous run built, pointing at whatever that run pointed at: a branch staging host since redeployed, torn down, or rebuilt for another branch. The run then exercises something real and wrong, and the result is green, which is the worst shape a failure can take. Leftovers come from the paths teardown does not cover — a cancelled job, a killed runner, a crash before cleanup. So the controls are unique per-job names, teardown registered for every exit including cancellation, and a scheduled reconciliation of what is up against what should be.

go deeper

for a junior

Know that a tunnel keeps running until something stops it, and that a cancelled job may never reach its cleanup step. If a run behaves as though it reached an old environment, say so rather than re-running it.

for a middle

Be able to explain why the harm depends on the name. Unique names make a leftover harmless to correctness; a reusable name lets the next job inherit a dead run's route and go green against the wrong target.

for a senior

Expect to be asked how you would find one. Describe reconciling the paths the far side reports as up against the jobs you believe are live, and treating anything in the first set but not the second as a leak to stop.

for a principal

You will be asked to make leftovers structurally rare rather than swept up. Argue for names carrying their run's identity, teardown attached to every exit path including cancellation, and a scheduled reconciliation nobody has to remember.

## How a tunnel outlives its job A tunnel is something that keeps running until something stops it. In a pipeline that something is a teardown step, and teardown is the part of a job that the unhappy paths skip: - The job was **cancelled** — a superseded push, somebody pressing stop — and the step that closes the path was never reached. - The **runner died**: out of memory, evicted, the machine reclaimed. Nothing local survived to clean up. - A step **failed before cleanup**, in a pipeline where teardown is written as the last step of the happy path rather than registered to run on any exit. - The teardown ran and **did not finish**, which is not the same as not running and is easy to mistake for success. Leftovers are not exotic. They are what a normal pipeline produces on its normal bad days. ## Why the damage depends on the name This is the part that is usually overstated in both directions, and the true statement is conditional. If tunnel names are **unique per job**, a leftover is a standing route that nothing will ever ask for. No later job names it, so none can be routed down it. It is still worth finding and stopping — it is reach into your network no live job accounts for, and it keeps consuming whatever it consumes — but it is not a correctness problem, and calling it one weakens the argument for the cases that are. If the name is **reusable** — one shared name, a name derived from the branch alone, anything a later run can produce again — the picture changes. The next job asking for that name can attach to a route the previous run built, pointing wherever the dead job's side pointed: a branch staging host since redeployed with different data, torn down, or rebuilt for a different branch entirely. The run then exercises something real and wrong. **The hazard is the pairing**, not either half alone: a tunnel that outlived its job *and* a name a later job can ask for. Either one on its own is untidy. Together they produce the worst result a test run can produce, which is a pass. ## What it looks like from inside the run Nothing looks broken, and that is the whole problem: - The session is created normally. - The page loads normally, because there is a real host at the other end. - Assertions about structure often pass, because a payroll portal's staging host rebuilt for another branch is still a payroll portal. - Assertions about data fail in ways that read like application bugs — a record that should exist and does not, a total that is off — and the reader spends the morning in the wrong repository. The tell, when there is one, is a **mismatch between what the run believed and what it saw**: the job was for one branch, and the page carries another's identity. That tell exists only if the run asserts identity at the start, which is the cheapest control here. ## Finding one You cannot see a leftover from the pipeline, because the pipeline believes that job is over. Reconciliation is what finds it, and it is a set difference: 1. **What the far side reports as currently up.** 2. **What your pipeline says is live right now.** Anything in the first set and not in the second is a leftover. Names that embed the run identifier make that comparison mechanical rather than a judgement call, because a name belonging to a finished run is recognisable on sight. Run it on a schedule rather than when somebody remembers, and have it report rather than only act, so the rate of leftovers is visible and can be driven down. What the far side does with a path nobody is using — how long it survives idle, whether it is ever closed for you, what it records — is that provider's own behaviour. Establish it by asking and by observing; never design a cleanup strategy around an assumed timeout. ## Preventing one - **Derive a name unique to the job**, so a leftover can never be attached to by a later run. That converts the correctness failure into a tidiness failure, which is a large improvement for little work. - **Register teardown for every exit path**, cancellation included, rather than writing it as the final step. Treat it as best-effort: it reduces leftovers, it does not eliminate them. - **Reconcile on a schedule**, and stop what should not be up. This is the control that catches what teardown structurally cannot: the cases where the runner did not survive to clean up after itself. - **Assert identity at the start of every run**, so a run that did attach to a stale route fails immediately with a message about the target rather than later with a message about a missing record. Two related subjects are deliberately not this one. A standing supplier path into your systems, considered as something to threat-model, is its own discipline, and what an open path consumes while nobody uses it belongs with the consumption model. What this question owns is narrower and more immediate: a route nobody meant to leave open, a later job that can still name it, and a green build that proves nothing.

  • How would you detect a tunnel that outlived its job, given the pipeline believes that job is over?
    Reconcile two sets: what the far side reports as currently up, and what your pipeline says is live right now. Anything in the first and not the second is a leftover. Names that embed the run identifier make the comparison mechanical rather than a judgement call, because a name from a finished run is recognisable on sight.
  • Why is teardown in the success path not enough?
    Because leftovers come almost entirely from paths that are not success. A cancelled job, a runner killed mid-step, a step that failed before cleanup — none of them reach a teardown written as the last step of the happy path. Register the stop so it runs on every exit, and still treat it as best-effort rather than assuming it always completes.
  • A leftover tunnel exists but names are unique per job. Is there still a reason to stop it?
    Yes, just not a correctness one. It is a standing route into your network that nobody is watching and no live job accounts for, and it keeps consuming whatever it consumes. Neither of those is the silent-wrong-target failure, and both are reasons to reconcile and stop it. The point of the distinction is knowing which risk you are actually arguing about.

A leftover tunnel with a reusable name is a mail-forwarding order nobody cancelled: the address still resolves, so nothing bounces, and the letters keep arriving quietly at the place you moved out of.

saying these in an interview costs you the question

  • Says a leftover tunnel always breaks the next job
  • Assumes the pipeline would show the job still running
  • Relies on teardown that runs only on the success path
  • Assumes an idle tunnel is always closed after some period
  • Treats a leftover purely as a spending problem
  • Cannot tell a stale route from a working one inside the run