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

使用gRPC接口传输数据时,限制消息大小4MB #96

Closed
Hiworle opened this issue Mar 1, 2024 · 1 comment
Closed

使用gRPC接口传输数据时,限制消息大小4MB #96

Hiworle opened this issue Mar 1, 2024 · 1 comment

Comments

@Hiworle
Copy link

Hiworle commented Mar 1, 2024

在使用grpc方式调用go-judge服务器的exec接口时,出现异常:

io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: grpc: received message larger than max (7100036 vs. 4194304)
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)

这似乎是由于创建grpc server时未指定消息大小导致的,添加配置后正常:

image

master...Hiworle:go-judge:master

我对golang不甚了解,有错误的地方还请指正。

@criyle
Copy link
Owner

criyle commented Mar 1, 2024

确实是有一个默认的 4M 限制,但是通常使用情况应该不太会逼近这个限制,例如输入文件在磁盘上用路径来引用的时候。如果这个限制调整是必要的,比如需要传入用户提供的大输入,那么一个武断的 64M 限制可能缺乏灵活性,更好的方案应该是一个 64M 默认值的命令行参数传入以提供更好的可调整性适应可能的变化。

@criyle criyle closed this as completed in da37931 Mar 4, 2024
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

No branches or pull requests

2 participants