Skip to content

Commit

Permalink
Increase max inbound gRPC message size (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
thpani authored Jun 30, 2023
1 parent c2dcffc commit f9c6084
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
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

0 comments on commit f9c6084

Please sign in to comment.