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

GEODE-2891 connect-timeout violation in C++ Native Client #105

Closed
wants to merge 2 commits into from
Closed

GEODE-2891 connect-timeout violation in C++ Native Client #105

wants to merge 2 commits into from

Conversation

gregt5259
Copy link

@gregt5259 gregt5259 commented Jul 2, 2017

The fix enables to interpret the time measure unit in handshake as milliseconds rather than seconds.

Copy link
Contributor

@jake-at-work jake-at-work left a comment

Choose a reason for hiding this comment

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

Please rebase your changes on develop rather than merge.

Do not include comments with ticket numbers.
Do not include comments with your name or initials.
Do not leave sources commented out, delete or delete not.

Please follow the C++ style of the community.

I am concerned with the approach of trying to define a pseudo message for handshaking to get a different timeout unit. This may bite us in the future when added new messages to the protocol.

There are a few tickets in flight, or soon to be in flight, that address this problem.

https://issues.apache.org/jira/browse/GEODE-3136
https://issues.apache.org/jira/browse/GEODE-3137

I have begun some experiments with GEODE-3136 and should start committing to it in a few days. All API exposed timeouts will be based on std::chrono::duration so you can clearly see what unit of time your time is and the code behind that API doesn't have to guess. GEODE-3137 will address on use cases internally that aren't addressed when updating the public API. Any configuration files that specify timeout will be updated to take a duration string as well in the format of "1234s", "1234ms", etc.

@@ -318,7 +318,9 @@ bool TcrConnection::InitTcrConnection(
LOGFINE("Attempting handshake with endpoint %s for %s%s connection", endpoint,
isClientNotification ? (isSecondary ? "secondary " : "primary ") : "",
isClientNotification ? "subscription" : "client");
ConnErrType error = sendData(data, msgLengh, connectTimeout, false);
// GT GEODE-2891
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not include comments with your name or the ticket number.

@@ -318,7 +318,9 @@ bool TcrConnection::InitTcrConnection(
LOGFINE("Attempting handshake with endpoint %s for %s%s connection", endpoint,
isClientNotification ? (isSecondary ? "secondary " : "primary ") : "",
isClientNotification ? "subscription" : "client");
ConnErrType error = sendData(data, msgLengh, connectTimeout, false);
// GT GEODE-2891
//ConnErrType error = sendData( data, msgLengh, connectTimeout, false );
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not leave commented out sources, this is what revision control is for.

sendTimeoutSec = sendTimeoutSec * 1000;
isPublicApiTimeout = true;
LOGDEBUG("sendData2 %d ", sendTimeoutSec);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Formatting does not conform to Google C++ Style Guide.

@@ -171,7 +173,8 @@ class CPPCACHE_EXPORT TcrMessage {
GET_DURABLE_CQS_DATA_ERROR = 106,
GET_ALL_WITH_CALLBACK = 107,
PUT_ALL_WITH_CALLBACK = 108,
REMOVE_ALL = 109
REMOVE_ALL = 109,
HANDSHAKE = 110
Copy link
Contributor

Choose a reason for hiding this comment

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

These numbers correspond to protocol message numbers on the server. We can just add one here and expect it not cause issues later.

@@ -44,6 +44,8 @@
#include <map>
#include <vector>

//
Copy link
Contributor

Choose a reason for hiding this comment

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

Clean this up.

@gregt5259
Copy link
Author

gregt5259 commented Jul 3, 2017 via email

@jake-at-work
Copy link
Contributor

I suggest to fix the issue by defining handshake pseudo message within the range probably defined for such pseudo messages by original design i.e.:
typedef enum {
/* Server couldn't read message; handle it like a server side
exception that needs retries */
HANDSHAKE = -3
NOT_PUBLIC_API_WITH_TIMEOUT = -2,

I think that would certainly work better but I think ultimately the fix is to remove the ambiguity between the C++ API and the Server API by strongly typing the duration values as addressed in the mentioned tickets. All duration values can be cast to the internal API supported unit without any ambiguity. After which there is no need to create this pseudo message to change the unit of the ambiguous int value.

@jake-at-work
Copy link
Contributor

@gregt5259 please close this pull request since you opened #106.

@gregt5259
Copy link
Author

Closed by Ernie Burghardt request as duplicated #106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants