Let's suppose there's async bidirectional stream in progress. So, a Channel 
is created, then it produces a Stub that used with a 
ClientAsyncReaderWriter to put Read and Write event in completion queue.

Now, for some reason, Channel is failed so hard it is in 
GRPC_CHANNEL_SHUTDOWN state. And I need to recreate a channel, a stub and 
reconnect it and then place tags again. And there are some tags in the 
completion queue. I'm not sure what's safe to assume at this point.

Can I assume that the moment a channel is shutdown, all tags are 
immediately in the queue with "not ok" flag and if there's a finish tag, a 
status used with the  ClientAsyncReaderWriter is guaranteed to be set to 
something, so I can safely delete the failed channel and all stubs with 
responders in no particular order, or there should be some deinitialization 
sequence like:

   - Wait for all tags placed by a particular ReaderWriter are out of the 
   queue
   - Then delete the ReaderWriter
   - When all ReaderWriters are deleted, then delete all stubs
   - When all stubs are deleted, then I can delete the Channel that created 
   the stubs
   - After that, I should recreate a Channel and all the things to restart 
   all streams

Or maybe something in between.

Couldn't find that in the docs (if there is, link please) and ChatGPT is 
definitely not a reliable source, so here's the question.

Also, maybe there's no way for Channel to be in GRPC_CHANNEL_SHUTDOWN at 
all unless there's memory corruption, so it's better to restart the whole 
app, or it can happen if a mobile network is out of range and for some 
reason even DNS servers are unavailable.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/18044f33-5240-42b5-959c-eab54db0091an%40googlegroups.com.

Reply via email to