mirror of
https://github.com/fosrl/pangolin.git
synced 2026-07-15 21:31:24 -05:00
[PR #3068] [CLOSED] Return error response for stale hole-punch rejection #36810
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/pangolin/pull/3068
Author: @rinseaid
Created: 5/14/2026
Status: ❌ Closed
Base:
main← Head:fix/stale-holepunch-error-response📝 Commits (8)
4786fc3Auto-create roles referenced in blueprints39f6973feat: add unique index on roles (orgId, name) with data migrationec3ceb7Merge branch 'blueprint-auto-create-roles' into patched2a38aceMerge branch 'roles-unique-orgid-name-index' into patchedcd39675Add workflow to build patched image to ghcr.io/rinseaid/pangolin:patched7301493Fix: build as ee to match deployed image242a6e3Fix: BUILD=enterprise, not ee9bb52c9Return error response for stale hole-punch rejection during Olm registration📊 Changes
11 files changed (+476 additions, -14 deletions)
View changed files
➕
.github/workflows/build-patched.yml(+37 -0)📝
server/db/pg/schema/schema.ts(+4 -1)📝
server/db/sqlite/schema/schema.ts(+5 -2)📝
server/lib/blueprints/clientResources.ts(+48 -6)📝
server/lib/blueprints/proxyResources.ts(+16 -2)📝
server/routers/olm/error.ts(+5 -0)📝
server/routers/olm/handleOlmRegisterMessage.ts(+1 -1)📝
server/setup/migrationsPg.ts(+3 -1)📝
server/setup/migrationsSqlite.ts(+3 -1)➕
server/setup/scriptsPg/1.19.0.ts(+170 -0)➕
server/setup/scriptsSqlite/1.19.0.ts(+184 -0)📄 Description
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Preface
This PR was developed with Claude Code (claude-opus-4-6). I identified the bug through live debugging of a broken Olm tunnel after a Pangolin server restart, traced the root cause through the code, and directed the fix. Claude wrote the patch. I reviewed and validated all changes.
Description
When
handleOlmRegisterMessagerejects a registration becauselastHolePunchis stale (more than 5 seconds old and the client has sites to receive), it performs a barereturnwith no response to the client. The client has no way to know its registration was rejected or why, so it retries blindly until it exhausts its retry budget (20 attempts at 2-second intervals), then gives up silently.This is particularly problematic during server restarts: the server's in-memory
lastHolePunchtimestamps reset, so the first registration attempt after reconnect is always rejected. Combined with the Olm re-registration bug (fosrl/olm#122), this creates a double failure where the client either never re-registers or re-registers into a silent rejection loop.Fix: Send an
olm/errorresponse with a newSTALE_HOLE_PUNCHerror code before returning. This uses the existingsendOlmErrorpattern that other rejection paths in the same function already use. The Olm client'shandleOlmErrorhandler will log the error and surface it via the API server status endpoint, giving users visibility into the failure.Related issues: #2951, #2901, #2318, #2343, #3041, #1526
Companion PR: fosrl/olm#122
How to test?
STALE_HOLE_PUNCHerror and logs it. The error is visible in the Olm status API.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.