lightninglabs / lightninglabs/aperture
proxy: retire transports and pricers from replaced service snapshots
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 268
- Forks
- 78
- Avg merge
- 22h 25m
- Merged PRs (30d)
- 1
Description
## Summary
`UpdateServices` creates a new `http.Transport` and may create new gRPC pricers on every successful update. It then overwrites the active service/backend snapshot without closing resources owned by the old snapshot. `Proxy.Close` only closes pricers in the currently published snapshot.
## Impact
Repeated service updates can accumulate idle HTTP connections, gRPC connections, goroutines, and file descriptors.
## Lifecycle constraint
Old pricers cannot simply be closed at publication time. Metered usage reports are launched asynchronously and can outlive the HTTP request that created them. Closing a retired pricer too early can lose usage reports or cause avoidable retries.
## Proposed direction
Give each published service generation explicit ownership and retirement:
- Close idle connections on the retired HTTP transport after its active requests drain.
- Track active requests and asynchronous metering reports that reference each generation/pricer.
- Close retired pricers only after both are drained, or provide a graceful retirement API.
- Ensure failed, unpublished snapshots are also fully closed.
## Acceptance criteria
- Repeated successful updates do not cause unbounded connection/goroutine/FD growth.
- In-flight requests continue using their original generation safely.
- Usage reports started by a retired generation complete before its pricer is closed.
- `Proxy.Close` drains or closes current and retired resources.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with UpdateServices and Proxy.Close, tracing ownership of each published service generation, active requests, and asynchronous metering reports. Define retirement and cleanup for replaced, failed, and current snapshots; done means repeated updates remain bounded, in-flight requests and usage reports complete safely, and Proxy.Close drains or closes all resources.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, grpc
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100