mirror of
https://github.com/fosrl/gerbil.git
synced 2026-07-15 12:37:11 -05:00
[PR #95] [CLOSED] fix(relay): re-notify server on reconnect with unchanged endpoint (clients stuck not registered) #808
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fosrl/gerbil/pull/95
Author: @DanivosYoun
Created: 6/13/2026
Status: ❌ Closed
Base:
main← Head:fix/holepunch-dedup-skips-reregistration📝 Commits (1)
bed4a6efix(relay): re-notify server on reconnect with unchanged endpoint📊 Changes
1 file changed (+14 additions, -2 deletions)
View changed files
📝
relay/relay.go(+14 -2)📄 Description
Problem
Since the hole-punch endpoint dedup (
lastEndpointCache) was added in 1.4.x, a reconnecting client can get stuck connected but not registered indefinitely.relay/relay.goskipsnotifyServer()(POST /gerbil/update-hole-punch) whenever the client's endpoint state is unchanged from a cached value:notifyServer()is not just an idempotent update — it is what (re)registers the client and returns theProxyMappingthat establishes routing. A reconnecting client (e.g. olm) commonly presents the same endpoint (same NAT IP:port + a persistent public key/token) while the server has already torn down its session on the previous disconnect. The dedup then suppresses the needed re-registration, so the server never returns a freshProxyMappingand the client stays in "Registering" forever. Because the cache is in-process, every reconnect from the same endpoint keeps hitting the dedup → the failure is permanent until gerbil restarts or the client's endpoint changes.Observed with gerbil 1.4.0/1.4.1 + olm 1.6.0 (latest) on a remote exit node; olm
/statusshowsconnected: true, registered: false, networkSettings: {}. gerbil 1.3.1 is unaffected (no dedup).Fix
Invalidate the cache entry in the dedup path (where sessions are already being cleared), so the next hole-punch falls through to
notifyServer()and re-establishes routing.notifyServer()is already asynchronous, so steady-state load stays bounded; this restores the pre-1.4 behaviour of re-notifying on repeated hole-punches.Reproduce
lastEndpointCache).connected: true, registered: false; noProxyMappingis created.Note
Filed as a hotfix PR; a companion issue with the full analysis follows. An alternative (kept-effective dedup) would be to skip only when an active
ProxyMappingfor the client still exists; happy to adjust to whichever the maintainers prefer.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.