-
Notifications
You must be signed in to change notification settings - Fork 886
Bound frozen RPC router batch allocations #4038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ func run() error { | |
| if err != nil { | ||
| return err | ||
| } | ||
| router, err := newRouter(cfg.liveNode, frozenNodes, nil, cfg.maxRequestBodySize, cfg.maxBlockReferenceDepth) | ||
| router, err := newRouter(cfg.liveNode, frozenNodes, nil, cfg.maxRequestBodySize, cfg.maxBlockReferenceDepth, cfg.batchRequestLimit) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
@@ -41,6 +41,7 @@ func run() error { | |
| Addr: cfg.listenAddress, | ||
| Handler: router, | ||
| ReadHeaderTimeout: 10 * time.Second, | ||
| WriteTimeout: cfg.writeTimeout, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Write timeout drops WebSocket connectionsHigh Severity
Additional Locations (2)Reviewed by Cursor Bugbot for commit ea3a257. Configure here. |
||
| IdleTimeout: 2 * time.Minute, | ||
| } | ||
|
|
||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion]
http.Server.WriteTimeoutis not a write-stall timeout: the deadline is armed when the request headers are read, so it bounds handler execution plus response write. For this router that means any single request whose upstream takes longer than 30s —debug_traceBlockByNumber,debug_getRawReceipts, a wideeth_getLogs, or a large mixed batch fanned out across frozen nodes — has its connection torn down mid-response, even though the client is fast and the upstream would have answered. That is exactly the archive-style workload this router fronts, and there is currently no upstreamhttp.Clienttimeout to keep such calls under the budget.Two things worth reconsidering:
parseConfigrejects--write-timeout 0, so an operator cannot restore the previous (unbounded) behavior. Allowing0to mean "no write timeout" — matchinghttp.Server's own convention — would keep the safe default while leaving an escape hatch. If a mandatory timeout is intended, that is worth stating explicitly, since it is a behavior change for existing deployments.For what it's worth, this does not affect the documented WebSocket passthrough:
net/http's(*conn).hijackLockedcallsrwc.SetDeadline(time.Time{})before returning the connection, soReverseProxy's upgrade path is left with no deadline. Only non-hijacked HTTP requests are affected.