Skip to content

Conversation

@mrfelton
Copy link

@mrfelton mrfelton commented Dec 9, 2025

The /swaps REST endpoint fails with ResourceExhausted errors when responses exceed the default 4 MiB gRPC limit. The server and REST gateway weren't configured with increased limits, unlike the client-side callers which already use 200-500 MiB.

Changes

  • Add maxMsgRecvSize constant (500 MiB) to match existing limits in lnd/connect.go and testframework/proxy.go
  • Configure gRPC server with MaxRecvMsgSize and MaxSendMsgSize
  • Configure REST gateway dial options with MaxCallRecvMsgSize
grpcSrv := grpc.NewServer(
    grpc.MaxRecvMsgSize(maxMsgRecvSize),
    grpc.MaxSendMsgSize(maxMsgRecvSize),
)

opts := []grpc.DialOption{
    grpc.WithTransportCredentials(insecure.NewCredentials()),
    grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgRecvSize)),
}

Copilot AI and others added 2 commits December 4, 2025 09:28
@YusukeShimizu
Copy link
Contributor

YusukeShimizu commented Dec 14, 2025

Thanks for addressing this.

Instead of raising the gRPC message size limit, how about adding paging (plus minimal filtering if needed) to ListSwaps / ListPeers so responses are bounded by default, since simply increasing the limit hides the symptom but still leaves response size and memory usage growing monotonically as history accumulates.

For backward compatibility, we could either keep the current behavior when paging params are omitted (return all) or introduce a new RPC.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants