I defined a service like:
service xxService {
ResultA funcA(),
ResultB funcB()
}
in a demo.thrift file, then I used thrift --gen rust demo.thrift, got a file named demo.rs, with funA() and funcB() defined in it.
The rpc server is written in java, and the client is written in rust.
When I called funcA() repeatedly and constantly to get some info from my rpc server, in the beginning everything went well, but after a few minutes, I got a transport error when calling funcA(), the call procedure is like this:
from
fn funcA() -> ResultA {
// other code
let message_ident = self.i_prot_mut().read_message_begin()?;
// other code
}
to
#[allow(clippy::collapsible_if)]
fn read_message_begin(&mut self) -> crate::Result<TMessageIdentifier> {
let mut first_bytes = vec![0; 4];
self.transport.read_exact(&mut first_bytes[..])?;
// other code
}
I found in debug mode that this error occured in the read_exact() method in function read_message_begin().This is the file of thrift named binary.rs.
The error look like this:
TransportError { kind: Unknown, message: "Resource temporarily unavailable (os error 11)" }
But I have no idea why it occured, the rpc client process and server process both look good.
Ignoring this error will receive same error in the next loop.