-
Notifications
You must be signed in to change notification settings - Fork 15
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
fixGwhisperHangOnDescDbStreamClose #147
fixGwhisperHangOnDescDbStreamClose #147
Conversation
…iption data. Signed-off-by: Rahman Abber Tahir <[email protected]>
Signed-off-by: Rahman Abber Tahir <[email protected]>
afab6ce
to
41810a5
Compare
Signed-off-by: Rahman Abber Tahir <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I understand this right: You are not setting the reflection stream deadline, instead you are trying to close it with a deadline, if this fails you bail out.
Looging good, just the thing about the cache.
@@ -350,12 +350,27 @@ void DescDbProxy::getDescriptors(const std::string &f_hostAddress) | |||
} | |||
} | |||
|
|||
grpc::Status DescDbProxy::closeDescDbStream(std::optional<std::chrono::time_point<std::chrono::system_clock>> deadline) | |||
{ | |||
if( m_disableCache == false )//cache enabled, no reflection stream required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a slippery slope.
If cache is enabled, we will still use the reflection stream, if the cache entry is outdated or if the cache does not hold data for the host.
see line 330
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see it. I change the condition to give prefence to m_reflectionDescDb check. if the ptr is valid we close the stream any how.
|
||
|
||
//before calling the RPC, close the DescDb connection with a timeout. | ||
grpc::Status dbDescStatus = ConnectionManager::getInstance().closeDescDbWithDeadline(serverAddress, deadline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to suggest moving all the closing into destructors and just drop the descriptor database / proxy when we do not need it any more.
However the ConnectionManager
singleton makes life hard here. gWhisper does not have the most beautiful design :-(
So I am fine with it as is. what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah ConnectionManager actually makes it hard. since we are also using shared ptrs here we would not know how many owners are there for the proxy and when will it actually closes.
Doing explicitly allows us to check the grpc status/result from calling the stream finish() aswell.
Yes we close the reflection stream after fecthing type/service info this we we don't couple the timeouts between reflection & main rpc. We also get the grpc status/result from the stream close by doing it early. |
…is invalid. Signed-off-by: Rahman Abber Tahir <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good now! I think it would be easier to just ignore the error when we try to close reflection stream when it was not opened.
wdyt? (feel free to merge as is, or update again)
if ( m_reflectionDescDb == nullptr ) | ||
{ | ||
if( m_disableCache == false )//cache enabled, no reflection stream required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just remove the check and return
once m_reflectionDescDb == nullptr
yields true? (meaning replace whe whole outer if
body with a return;
)
Sotty github woudn't let me write a suggestion for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, the unique ptr == null garauntees the stream is already closed. that is actually a valid case.
Signed-off-by: Rahman Abber Tahir <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks for the effort! Let me know if this helps long-term and catches all scenarios.
close reflection stream with a deadline after fetching services description data.
Dynamic deadlines are now propagated to the DescDb stream close.
The db stream is now closed after 2 (after fetching name and type info from server).