Skip to content

Commit b57a339

Browse files
osalpekarfacebook-github-bot
authored andcommitted
Guard against negative rpcTimeout being passed in to RpcBackendOptions (#38267)
Summary: Pull Request resolved: #38267 Assert that the rpcTimeout is positive in RpcBackendOptions constructor ghstack-source-id: 104029918 Test Plan: CI Differential Revision: D21509850 fbshipit-source-id: c925490e3d8fa2ffa42b0ae1170ca2f740af11f7
1 parent d1eeb3b commit b57a339

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

torch/csrc/distributed/rpc/rpc_agent.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ struct RpcBackendOptions {
3232

3333
RpcBackendOptions(float rpcTimeoutSeconds, std::string initMethod)
3434
: rpcTimeoutSeconds(rpcTimeoutSeconds),
35-
initMethod(std::move(initMethod)) {}
35+
initMethod(std::move(initMethod)) {
36+
TORCH_CHECK(rpcTimeoutSeconds >= 0, "RPC Timeout must be non-negative");
37+
}
3638

3739
float rpcTimeoutSeconds;
3840
std::string initMethod;

0 commit comments

Comments
 (0)