lightninglabs / lightninglabs/aperture

proxy: allow service updates while long-lived requests are active

Open
#266 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
268
Forks
78
Avg merge
22h 25m
Merged PRs (30d)
1

Description

Summary

ServeHTTP holds servicesMtx.RLock across service matching, authentication, external store/pricer calls, and the full reverse-proxy response. UpdateServices needs the write lock.

A hung backend request or long-lived gRPC/streaming response can therefore prevent configuration updates indefinitely.

Impact

One request can block operational changes such as updating a backend, changing authentication policy, or deploying an emergency configuration. This is especially problematic for services intended to maintain long-lived streams.

Proposed direction

Publish immutable service/backend generations:

  1. Acquire the read lock only long enough to capture the current generation.
  2. Release it before authentication and backend I/O.
  3. Track generation references while requests use it.
  4. Retire and clean up old generation resources after their references drain.

This should be coordinated with transport/pricer retirement so shortening the lock does not close resources still used by requests or metering reports.

Acceptance criteria

  • A long-lived request on generation A does not prevent publishing generation B.
  • The request continues safely on generation A.
  • New requests use generation B immediately after publication.
  • Retired resources are eventually reclaimed without races.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the ServeHTTP and UpdateServices entry points described in the issue, focusing on the service lock, generation lifetime, and transport/pricer cleanup. Trace how requests retain backend resources and how updates publish configuration. Done means generation B is immediately used by new requests, generation A remains safe for active long-lived requests, and retired resources are reclaimed without races.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.