-
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
Changes from 4 commits
a6c4cdb
41810a5
1ba0ac8
fac023c
1c7d225
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -350,12 +350,26 @@ 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_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 commentThe reason will be displayed to describe this comment to others. Learn more. What about just remove the check and Sotty github woudn't let me write a suggestion for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
{ | ||
return grpc::Status::OK; | ||
} | ||
std::cerr << "Exit - no reflectionDescDb initialized." <<std::endl; | ||
exit(EXIT_FAILURE); | ||
} | ||
return m_reflectionDescDb->closeStreamWithDeadline(deadline); | ||
} | ||
|
||
DescDbProxy::DescDbProxy(bool disableCache, const std::string &hostAddress, std::shared_ptr<grpc::Channel> channel, | ||
ArgParse::ParsedElement &parseTree) | ||
{ | ||
m_channel = channel; | ||
m_parseTree = parseTree; | ||
|
||
m_disableCache = disableCache; | ||
if(disableCache) | ||
{ | ||
// Get Desc directly via reflection and without touching localDB | ||
|
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.