Skip to content
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

add hard-coded deadline for reflection stream. #150

Merged
merged 8 commits into from
Dec 4, 2023

Conversation

abb3r
Copy link

@abb3r abb3r commented Nov 22, 2023

No description provided.

@abb3r abb3r changed the title add hard-code deadline for refelection stream. add hard-coded deadline for reflection stream. Nov 22, 2023
Rahman Abber Tahir added 2 commits November 22, 2023 21:35
Signed-off-by: Rahman Abber Tahir <[email protected]>
Signed-off-by: Rahman Abber Tahir <[email protected]>
@@ -32,6 +32,7 @@ using grpc::reflection::v1alpha::ServerReflection;
using grpc::reflection::v1alpha::ServerReflectionRequest;
using grpc::reflection::v1alpha::ServerReflectionResponse;

const uint8_t g_timeoutGrpcMainStreamSeconds = 20; //using default gwhisper timeout of 20 seconds.
Copy link
Author

@abb3r abb3r Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

increased since we already have default rpc timeout of 30secs anyway, is that too big? we saw that 10secs easily times out on slower systems.

@rainerschoe
Copy link
Member

Sorry, did not have time to review this week, will have a look, as soon as I have a free minute next week :-)

}
//before calling the RPC, close the DescDb connection with a default timeout. We still continue with rpc call
//but remove the cache file if the stream was not closed gracefully so it fetches the reflection data again next time.
grpc::Status dbDescStatus = ConnectionManager::getInstance().closeDescDbStream(serverAddress);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
grpc::Status dbDescStatus = ConnectionManager::getInstance().closeDescDbStream(serverAddress);
ConnectionManager::getInstance().closeDescDbStream(serverAddress);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -75,7 +74,7 @@ namespace cli
}

//if proxy exists close the stream with a deadline.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//if proxy exists close the stream with a deadline.
//if proxy exists close the stream

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/libCli/libCli/ConnectionManager.hpp Outdated Show resolved Hide resolved
status = m_reflectionDescDb->closeDescDbStream();
if(not status.ok())
{
//failure to close stream leads to invalid cache,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good thought :)

DescDbProxy::~DescDbProxy()
{
closeDescDbStream(); //close it here to ensure invalid cache file is removed if an error occurs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, isn't destructor called each time gwhisper terminates?

If so, we would invalidate the cache each time. This would make the cache use-less :P It's only purpose is to transport descriptr info from one invocation the the next.
(e.g. every time a user presses gwhisper is started afresh and parses the input / gets descriptors without cache)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the proxy dtor is called evrytime.
actually the reflection stream if already closed gracefully will be make the close at proxy dtor a noop since we check for nullptr.
The cache is only invalidated if we fail to close the stream in time. so we don't disable it and the functional tests are green to prove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, understand. Maybe add a comment in the destructor.
Then it should be OK

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@rainerschoe rainerschoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving gWhisper :-)

@rainerschoe rainerschoe merged commit de4adde into IBM:master Dec 4, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants