You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2020/06/25 18:38:37 UTC
[geode-native] branch develop updated: GEODE-8297: fix tcrmessage
timeout (#623)
This is an automated email from the ASF dual-hosted git repository.
bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new e5a0b9a GEODE-8297: fix tcrmessage timeout (#623)
e5a0b9a is described below
commit e5a0b9a0ca9a35ef3c2cafde866af1705bc7a006
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Thu Jun 25 11:38:29 2020 -0700
GEODE-8297: fix tcrmessage timeout (#623)
- Use correct initialization for TcrMessage::m_timeout
- Intent was to set it 15 seconds, but it was actually being set to 15ms
- Rename DEFAULT_TIMEOUT constants, remove units from name since they're no longer relevant
---
cppcache/src/Connector.hpp | 9 +++------
cppcache/src/TcpConn.hpp | 11 +++++------
cppcache/src/TcpSslConn.hpp | 2 +-
cppcache/src/TcrConnection.cpp | 7 +++----
cppcache/src/TcrConnection.hpp | 6 +++---
cppcache/src/TcrMessage.cpp | 30 +++++++++++++++---------------
6 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/cppcache/src/Connector.hpp b/cppcache/src/Connector.hpp
index ce5a9ad..1c445c3 100644
--- a/cppcache/src/Connector.hpp
+++ b/cppcache/src/Connector.hpp
@@ -32,14 +32,11 @@ namespace client {
constexpr std::chrono::microseconds DEFAULT_CONNECT_TIMEOUT =
std::chrono::seconds(10);
-constexpr std::chrono::milliseconds DEFAULT_TIMEOUT_SECONDS =
- std::chrono::seconds(15);
+constexpr std::chrono::milliseconds DEFAULT_TIMEOUT = std::chrono::seconds(15);
-constexpr std::chrono::milliseconds DEFAULT_READ_TIMEOUT_SECS =
- DEFAULT_TIMEOUT_SECONDS;
+constexpr std::chrono::milliseconds DEFAULT_READ_TIMEOUT = DEFAULT_TIMEOUT;
-constexpr std::chrono::milliseconds DEFAULT_WRITE_TIMEOUT =
- DEFAULT_TIMEOUT_SECONDS;
+constexpr std::chrono::milliseconds DEFAULT_WRITE_TIMEOUT = DEFAULT_TIMEOUT;
class Connector {
public:
diff --git a/cppcache/src/TcpConn.hpp b/cppcache/src/TcpConn.hpp
index cc8cfc6..0bbec30 100644
--- a/cppcache/src/TcpConn.hpp
+++ b/cppcache/src/TcpConn.hpp
@@ -94,15 +94,14 @@ class APACHE_GEODE_EXPORT TcpConn : public Connector {
void init() override;
// Listen
- void listen(
- const char* hostname, int32_t port,
- std::chrono::microseconds waitSeconds = DEFAULT_READ_TIMEOUT_SECS);
- void listen(const char* ipaddr, std::chrono::microseconds waitSeconds =
- DEFAULT_READ_TIMEOUT_SECS);
+ void listen(const char* hostname, int32_t port,
+ std::chrono::microseconds waitSeconds = DEFAULT_READ_TIMEOUT);
+ void listen(const char* ipaddr,
+ std::chrono::microseconds waitSeconds = DEFAULT_READ_TIMEOUT);
virtual void listen(
ACE_INET_Addr addr,
- std::chrono::microseconds waitSeconds = DEFAULT_READ_TIMEOUT_SECS);
+ std::chrono::microseconds waitSeconds = DEFAULT_READ_TIMEOUT);
// connect
void connect(const char* hostname, int32_t port,
diff --git a/cppcache/src/TcpSslConn.hpp b/cppcache/src/TcpSslConn.hpp
index 953f78f..c14a5b5 100644
--- a/cppcache/src/TcpSslConn.hpp
+++ b/cppcache/src/TcpSslConn.hpp
@@ -80,7 +80,7 @@ class TcpSslConn : public TcpConn {
// Listen
void listen(ACE_INET_Addr addr, std::chrono::microseconds waitSeconds =
- DEFAULT_READ_TIMEOUT_SECS) override;
+ DEFAULT_READ_TIMEOUT) override;
// connect
void connect() override;
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index d841631..79a5002 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -680,9 +680,8 @@ char* TcrConnection::readMessage(size_t* recvLen,
ConnErrType error;
std::chrono::microseconds headerTimeout = receiveTimeoutSec;
- if (doHeaderTimeoutRetries &&
- receiveTimeoutSec == DEFAULT_READ_TIMEOUT_SECS) {
- headerTimeout = DEFAULT_READ_TIMEOUT_SECS * DEFAULT_TIMEOUT_RETRIES;
+ if (doHeaderTimeoutRetries && receiveTimeoutSec == DEFAULT_READ_TIMEOUT) {
+ headerTimeout = DEFAULT_READ_TIMEOUT * DEFAULT_TIMEOUT_RETRIES;
}
LOGDEBUG("TcrConnection::readMessage: receiving reply from endpoint %s",
@@ -831,7 +830,7 @@ void TcrConnection::readMessageChunked(TcrMessageReply& reply,
std::chrono::microseconds TcrConnection::calculateHeaderTimeout(
std::chrono::microseconds receiveTimeout, bool retry) {
auto headerTimeout = receiveTimeout;
- if (retry && receiveTimeout == DEFAULT_READ_TIMEOUT_SECS) {
+ if (retry && receiveTimeout == DEFAULT_READ_TIMEOUT) {
headerTimeout *= DEFAULT_TIMEOUT_RETRIES;
}
return headerTimeout;
diff --git a/cppcache/src/TcrConnection.hpp b/cppcache/src/TcrConnection.hpp
index 51ca6e8..1a6f437 100644
--- a/cppcache/src/TcrConnection.hpp
+++ b/cppcache/src/TcrConnection.hpp
@@ -193,7 +193,7 @@ class TcrConnection {
char* sendRequest(
const char* buffer, size_t len, size_t* recvLen,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
- std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT_SECS,
+ std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT,
int32_t request = -1);
/**
@@ -211,7 +211,7 @@ class TcrConnection {
void sendRequestForChunkedResponse(
const TcrMessage& request, size_t len, TcrMessageReply& message,
std::chrono::microseconds sendTimeoutSec = DEFAULT_WRITE_TIMEOUT,
- std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT_SECS);
+ std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT);
/**
* send an asynchronized request to server. No response is expected.
@@ -247,7 +247,7 @@ class TcrConnection {
*/
char* receive(
size_t* recvLen, ConnErrType* opErr,
- std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT_SECS);
+ std::chrono::microseconds receiveTimeoutSec = DEFAULT_READ_TIMEOUT);
// readMessage is now public
/**
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 43894c2..32f1706 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -124,7 +124,7 @@ TcrMessage::TcrMessage()
m_chunkedResult(nullptr),
m_keyList(nullptr),
m_region(nullptr),
- m_timeout(15 /*DEFAULT_TIMEOUT_SECONDS*/),
+ m_timeout(DEFAULT_TIMEOUT),
m_metadata(),
m_cqs(nullptr),
m_messageResponseTimeout(-1),
@@ -1632,7 +1632,7 @@ TcrMessageDestroyRegion::TcrMessageDestroyRegion(
m_regionName =
region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
uint32_t numOfParts = 1;
@@ -1669,7 +1669,7 @@ TcrMessageClearRegion::TcrMessageClearRegion(
m_regionName =
region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
isSecurityOn = false;
@@ -1706,7 +1706,7 @@ TcrMessageQuery::TcrMessageQuery(
m_msgType = TcrMessage::QUERY;
m_tcdm = connectionDM;
m_regionName = regionName; // this is querystri;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
m_region = nullptr;
uint32_t numOfParts = 1;
@@ -1733,7 +1733,7 @@ TcrMessageStopCQ::TcrMessageStopCQ(
m_msgType = TcrMessage::STOPCQ_MSG_TYPE;
m_tcdm = connectionDM;
m_regionName = regionName; // this is querystring
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
m_region = nullptr;
m_isSecurityHeaderAdded = false;
@@ -1764,7 +1764,7 @@ TcrMessageCloseCQ::TcrMessageCloseCQ(
m_msgType = TcrMessage::CLOSECQ_MSG_TYPE;
m_tcdm = connectionDM;
m_regionName = regionName; // this is querystring
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
m_region = nullptr;
uint32_t numOfParts = 1;
@@ -1793,7 +1793,7 @@ TcrMessageQueryWithParameters::TcrMessageQueryWithParameters(
m_msgType = TcrMessage::QUERY_WITH_PARAMETERS;
m_tcdm = connectionDM;
m_regionName = regionName;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_messageResponseTimeout = messageResponsetimeout;
m_region = nullptr;
@@ -1833,7 +1833,7 @@ TcrMessageContainsKey::TcrMessageContainsKey(
m_regionName =
region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
uint32_t numOfParts = 2;
if (aCallbackArgument != nullptr) {
@@ -1863,7 +1863,7 @@ TcrMessageGetDurableCqs::TcrMessageGetDurableCqs(
m_request.reset(dataOutput);
m_msgType = TcrMessage::GETDURABLECQS_MSG_TYPE;
m_tcdm = connectionDM;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_region = nullptr;
// wrirting msgtype with part length =1
writeHeader(m_msgType, 1);
@@ -1884,7 +1884,7 @@ TcrMessageRequest::TcrMessageRequest(
m_regionName =
(region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
uint32_t numOfParts = 2;
if (aCallbackArgument != nullptr) {
@@ -1922,7 +1922,7 @@ TcrMessageInvalidate::TcrMessageInvalidate(
m_regionName =
(region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
uint32_t numOfParts = 2;
if (aCallbackArgument != nullptr) {
@@ -1961,7 +1961,7 @@ TcrMessageDestroy::TcrMessageDestroy(
m_regionName =
(region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath());
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
uint32_t numOfParts = 2;
if (aCallbackArgument != nullptr) {
++numOfParts;
@@ -2018,7 +2018,7 @@ TcrMessagePut::TcrMessagePut(
m_key = key;
m_regionName = region != nullptr ? region->getFullPath() : regionName;
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
// TODO check the number of parts in this constructor. doubt because in PUT
// value can be nullptr also.
@@ -2114,7 +2114,7 @@ TcrMessageRegisterInterestList::TcrMessageRegisterInterestList(
m_regionName =
region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_isDurable = isDurable;
m_receiveValues = receiveValues;
@@ -2169,7 +2169,7 @@ TcrMessageUnregisterInterestList::TcrMessageUnregisterInterestList(
m_regionName =
region == nullptr ? "INVALID_REGION_NAME" : region->getFullPath();
m_region = region;
- m_timeout = DEFAULT_TIMEOUT_SECONDS;
+ m_timeout = DEFAULT_TIMEOUT;
m_isDurable = isDurable;
m_receiveValues = receiveValues;