I have taken an extract from “include/grpcpp/impl/codegen/async_stream.h”
“
/// Request the writing of \a msg with identifying tag \a tag.
///
/// Only one write may be outstanding at any given time. This means that
/// after calling Write, one must wait to receive \a tag from the completion
/// queue BEFORE calling Write again.
/// This is thread-safe with respect to \a AsyncReaderInterface::Read
///
/// gRPC doesn't take ownership or a reference to \a msg, so it is safe to
/// to deallocate once Write returns.
///
/// \param[in] msg The message to be written.
/// \param[in] tag The tag identifying the operation.
virtual void Write(const W& msg, void* tag) = 0;
“
After reading the highlighted part, I can make the following two inferences:
Can you please help us in understanding which one of our above inferences is true?
Recently, I came across an issue where the gRPC client became a zombie process as its parent Python application was aborted. In this condition, the previous Write done on the stream connected with the client did not get ack, probably, and I did not receive the Write tag back in the completion queue for that Write. My program kept waiting for the write tag and other messages continued to queue up as the previous Write did not finish its life cycle and hence I could not free the resources also for that tag.
I was wondering if I could have gone ahead with Write for other streams and queue up messages related to this stream till we get a write tag in return for the previous message. If I kill the zombie and clean up on the client, the Write tag is returned
Alternatively, is it possible to force cleanup the inactive gRPC session ? What would happen if the Write tag is returned after the internal memory for that tag had been cleaned up . I guess it will crash.
Please clarify the doubts,
Regards
Ashutosh (Ciena)