Skip to content

fix(gnodev): rewrite lazy loading proxy as HTTP reverse proxy#5276

Open
jaekwon wants to merge 1 commit intomasterfrom
fix/jae/gnodev-lazyload
Open

fix(gnodev): rewrite lazy loading proxy as HTTP reverse proxy#5276
jaekwon wants to merge 1 commit intomasterfrom
fix/jae/gnodev-lazyload

Conversation

@jaekwon
Copy link
Contributor

@jaekwon jaekwon commented Mar 12, 2026

Summary

  • Rewrote the gnodev lazy loading proxy (PathInterceptor) from a TCP-level proxy to an HTTP reverse proxy using httputil.ReverseProxy
  • The old TCP proxy maintained a persistent connection to the node's RPC server. When a PathHandler triggered a node reload (stop + restart), that connection died, causing the query that triggered the reload to silently fail — breaking the
    core dev workflow of edit → query → see results
  • With the HTTP reverse proxy, each request gets a fresh connection. The handler runs synchronously before forwarding, so after a reload the request naturally connects to the new node
  • Disabled keep-alive on the transport to prevent stale pooled connections after restarts
  • Added TestProxyRestart which validates that queries succeed even when the handler stops and restarts the node mid-request

Test plan

  • All 6 existing proxy tests pass unchanged (query interception, tx interception, websocket, passthrough)
  • New TestProxyRestart reproduces the exact bug scenario — handler stops the node and starts a new one during request processing, verifies the query still returns a valid response
  • go build ./... compiles cleanly with no API changes to consumers (app.go)
  • Manual testing: run gnodev with --lazy-loader, navigate to a realm in gnoweb, verify it loads without needing to press 'R'

The TCP proxy maintained a persistent connection to the node's RPC server.
When a PathHandler triggered a node reload (stop + restart), that connection
died, causing the query that triggered the reload to silently fail.

Replace the TCP-level proxy with an HTTP reverse proxy (httputil.ReverseProxy)
so each request gets a fresh connection. The handler runs synchronously before
forwarding, so after a reload the request naturally connects to the new node.

Disable keep-alive on the transport to prevent stale pooled connections after
restarts. Add TestProxyRestart to validate queries succeed across node restarts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Mar 12, 2026

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

No automated checks match this pull request.

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@jaekwon jaekwon requested a review from gfanton March 12, 2026 00:47
@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 59.61538% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
contribs/gnodev/pkg/proxy/path_interceptor.go 59.61% 17 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants