Skip to content
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

Increase max inbound gRPC message size #2623

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .unreleased/bug-fixes/2623-grpc-msg-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Increase max inbound gRPC message size, see #2623
12 changes: 12 additions & 0 deletions shai/src/main/scala/at/forsyte/apalache/shai/v1/RpcServer.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package at.forsyte.apalache.shai.v1

import zio.{console, Ref, ZEnv, ZIO}

import java.util.UUID
import scalapb.zio_grpc.ServerMain
import scalapb.zio_grpc.ServiceList
import com.typesafe.scalalogging.LazyLogging
import io.grpc.ServerBuilder

/**
* The Shai RPC server handling gRPC requests to interact with the model checker
Expand All @@ -27,6 +29,16 @@ class RpcServer(override val port: Int) extends ServerMain with LazyLogging {

def services: ServiceList[ZEnv] =
ServiceList.addM(createTransExplorerService).addM(createCmdExecutorService)

// Enable existential types; builder's signature below cannot be expressed using wildcards.
// This is needed even if the type below is omitted / inferred.
import scala.language.existentials

// Double max inbound message size to 8MB
// Fixes `io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size`:
// https://github.com/informalsystems/apalache/issues/2622
override def builder: (x0) forSome { type x0 <: ServerBuilder[x0] } =
super.builder.maxInboundMessageSize(8 * 1024 * 1024)
}

object RpcServer {
Expand Down