From 62d19c78f9526963d07c0b2020a67cc8839c6da2 Mon Sep 17 00:00:00 2001 From: Blake Bender Date: Wed, 13 Nov 2019 10:19:18 -0800 Subject: [PATCH 1/5] GEODE-7447: Fix logging format spec <--> variable size mismatches - std::chrono 'Rep' type changes size based on platform - when size mismatched to format spec in log call, bad things happen --- cppcache/src/EntryExpiryHandler.cpp | 9 +++++---- cppcache/src/LocalRegion.cpp | 18 +++++++++--------- cppcache/src/RegionExpiryHandler.cpp | 14 ++++++++------ cppcache/src/TcpConn.cpp | 4 ++-- cppcache/src/TcpSslConn.cpp | 4 ++-- cppcache/src/TcrConnection.cpp | 9 +++++---- cppcache/src/TcrEndpoint.cpp | 13 +++++++------ cppcache/src/ThinClientRegion.cpp | 10 ++++++---- 8 files changed, 44 insertions(+), 37 deletions(-) diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp index 7a8c4c7c73..fc6b76cb1c 100644 --- a/cppcache/src/EntryExpiryHandler.cpp +++ b/cppcache/src/EntryExpiryHandler.cpp @@ -58,12 +58,13 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, auto elapsed = curr_time - lastTimeForExp; LOGDEBUG( "Entered entry expiry task handler for key [%s] of region [%s]: " - "%z,%z,%z,%z", + "%s,%s,%s,%s", Utils::nullSafeToString(key).c_str(), m_regionPtr->getFullPath().c_str(), - curr_time.time_since_epoch().count(), - lastTimeForExp.time_since_epoch().count(), m_duration.count(), - elapsed.count()); + std::to_string(curr_time.time_since_epoch().count()).c_str(), + std::to_string(lastTimeForExp.time_since_epoch().count()).c_str(), + std::to_string(m_duration.count()).c_str()), + std::to_string(elapsed.count()).c_str()); if (elapsed >= m_duration) { DoTheExpirationAction(key); } else { diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp index a30f49bc4d..5c420d1b00 100644 --- a/cppcache/src/LocalRegion.cpp +++ b/cppcache/src/LocalRegion.cpp @@ -695,10 +695,10 @@ void LocalRegion::setRegionExpiryTask() { handler, duration, std::chrono::seconds::zero()); handler->setExpiryTaskId(expiryTaskId); LOGFINE( - "expiry for region [%s], expiry task id = %z, duration = %z, " + "expiry for region [%s], expiry task id = %z, duration = %s, " "action = %d", - m_fullPath.c_str(), expiryTaskId, duration.count(), - getRegionExpiryAction()); + m_fullPath.c_str(), expiryTaskId, + std::to_string(duration.count()).c_str(), getRegionExpiryAction()); } } @@ -719,9 +719,9 @@ void LocalRegion::registerEntryExpiryTask( entry->getKeyI(key); LOGFINEST( "entry expiry in region [%s], key [%s], task id = %z, " - "duration = %z, action = %d", + "duration = %s, action = %d", m_fullPath.c_str(), Utils::nullSafeToString(key).c_str(), id, - duration.count(), getEntryExpirationAction()); + std::to_string(duration.count()).c_str(), getEntryExpirationAction()); } expProps.setExpiryTaskId(id); } @@ -2796,14 +2796,14 @@ void LocalRegion::updateAccessAndModifiedTimeForEntry( ptr->getKeyI(key); keyStr = Utils::nullSafeToString(key); } - LOGDEBUG("Setting last accessed time for key [%s] in region %s to %z", + LOGDEBUG("Setting last accessed time for key [%s] in region %s to %s", keyStr.c_str(), getFullPath().c_str(), - currTime.time_since_epoch().count()); + std::to_string(currTime.time_since_epoch().count()).c_str()); expProps.updateLastAccessTime(currTime); if (modified) { - LOGDEBUG("Setting last modified time for key [%s] in region %s to %z", + LOGDEBUG("Setting last modified time for key [%s] in region %s to %s", keyStr.c_str(), getFullPath().c_str(), - currTime.time_since_epoch().count()); + std::to_string(currTime.time_since_epoch().count()).c_str()); expProps.updateLastModifiedTime(currTime); } } diff --git a/cppcache/src/RegionExpiryHandler.cpp b/cppcache/src/RegionExpiryHandler.cpp index a10d8cf1e6..3cc9f1f1af 100644 --- a/cppcache/src/RegionExpiryHandler.cpp +++ b/cppcache/src/RegionExpiryHandler.cpp @@ -55,19 +55,21 @@ int RegionExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, } auto elapsed = curr_time - lastTimeForExp; - LOGDEBUG("Entered region expiry task handler for region [%s]: %z,%z,%z,%z", + LOGDEBUG("Entered region expiry task handler for region [%s]: %s,%s,%s,%s", m_regionPtr->getFullPath().c_str(), - curr_time.time_since_epoch().count(), - lastTimeForExp.time_since_epoch().count(), m_duration.count(), - elapsed.count()); + std::to_string(curr_time.time_since_epoch().count()).c_str(), + std::to_string(lastTimeForExp.time_since_epoch().count()).c_str(), + std::to_string(m_duration.count()).c_str(), + std::to_string(elapsed.count()).c_str()); if (elapsed >= m_duration) { DoTheExpirationAction(); } else { auto remaining = m_duration - elapsed; // reset the task after // (lastAccessTime + entryExpiryDuration - curr_time) in seconds - LOGDEBUG("Resetting expiry task for region [%s] after %z sec", - m_regionPtr->getFullPath().c_str(), remaining.count()); + LOGDEBUG("Resetting expiry task for region [%s] after %s sec", + m_regionPtr->getFullPath().c_str(), + std::to_string(remaining.count()).c_str()); m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask( m_expiryTaskId, remaining); return 0; diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp index 9dd6c97f62..27ba8b96b4 100644 --- a/cppcache/src/TcpConn.cpp +++ b/cppcache/src/TcpConn.cpp @@ -209,9 +209,9 @@ void TcpConn::connect() { ACE_OS::signal(SIGPIPE, SIG_IGN); // Ignore broken pipe - LOGFINER("Connecting plain socket stream to %s:%d waiting %z micro sec", + LOGFINER("Connecting plain socket stream to %s:%d waiting %s micro sec", ipaddr.get_host_name(), ipaddr.get_port_number(), - waitMicroSeconds.count()); + std::to_string(waitMicroSeconds.count()).c_str()); ACE_SOCK_Connector conn; int32_t retVal = 0; diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp index 539b80c59a..6921afa355 100644 --- a/cppcache/src/TcpSslConn.cpp +++ b/cppcache/src/TcpSslConn.cpp @@ -91,9 +91,9 @@ void TcpSslConn::connect() { std::chrono::microseconds waitMicroSeconds = m_waitMilliSeconds; - LOGDEBUG("Connecting SSL socket stream to %s:%d waiting %z micro sec", + LOGDEBUG("Connecting SSL socket stream to %s:%d waiting %s micro sec", m_addr.get_host_name(), m_addr.get_port_number(), - waitMicroSeconds.count()); + std::to_string(waitMicroSeconds.count()).c_str()); int32_t retVal = m_ssl->connect(m_addr, waitMicroSeconds); diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp index 70febbf295..c218f19b21 100644 --- a/cppcache/src/TcrConnection.cpp +++ b/cppcache/src/TcrConnection.cpp @@ -616,8 +616,8 @@ inline ConnErrType TcrConnection::receiveData( readHandshakeRawData, readHandShakeBytes, readHandShakeInt, readHandshakeString, all call TcrConnection::receiveData. */ - LOGDEBUG("TcrConnection::receiveData length = %zu defaultWaitSecs = %z", - length, defaultWaitSecs.count()); + LOGDEBUG("TcrConnection::receiveData length = %zu defaultWaitSecs = %s", + length, std::to_string(defaultWaitSecs.count()).c_str()); if (m_poolDM != nullptr) { LOGDEBUG("TcrConnection::receiveData readBytes = %zu", readBytes); m_poolDM->getStats().incReceivedBytes(static_cast(readBytes)); @@ -645,9 +645,10 @@ inline ConnErrType TcrConnection::sendData( std::chrono::microseconds defaultWaitSecs = std::chrono::seconds(2); if (defaultWaitSecs > sendTimeout) defaultWaitSecs = sendTimeout; LOGDEBUG( - "before send len %zu sendTimeoutSec = %z checkConnected = %d m_connected " + "before send len %zu sendTimeoutSec = %s checkConnected = %d m_connected " "%d", - length, sendTimeout.count(), checkConnected, m_connected); + length, std::to_string(sendTimeout.count()).c_str(), checkConnected, + m_connected); while (length > 0 && sendTimeout > std::chrono::microseconds::zero()) { if (checkConnected && !m_connected) { return CONN_IOERR; diff --git a/cppcache/src/TcrEndpoint.cpp b/cppcache/src/TcrEndpoint.cpp index 293a3142a8..8f7666bcbf 100644 --- a/cppcache/src/TcrEndpoint.cpp +++ b/cppcache/src/TcrEndpoint.cpp @@ -185,9 +185,10 @@ GfErrType TcrEndpoint::createNewConnection( std::chrono::microseconds connectTimeout, int32_t timeoutRetries, bool appThreadRequest) { LOGFINE( - "TcrEndpoint::createNewConnection: connectTimeout =%z " + "TcrEndpoint::createNewConnection: connectTimeout =%s " "m_needToConnectInLock=%d appThreadRequest =%d", - connectTimeout.count(), m_needToConnectInLock, appThreadRequest); + std::to_string(connectTimeout.count()).c_str(), m_needToConnectInLock, + appThreadRequest); GfErrType err = GF_NOERR; newConn = nullptr; while (timeoutRetries-- >= 0) { @@ -923,8 +924,8 @@ GfErrType TcrEndpoint::sendRequestWithRetry( } else if (conn == nullptr && useEPPool) { LOGFINER( "sendRequestWithRetry:: looking for connection in queue timeout = " - "%z ", - timeout.count()); + "%s", + std::to_string(timeout.count()).c_str()); // max wait time to get a connection conn = m_opConnections.getUntil(timeout); } @@ -1051,9 +1052,9 @@ GfErrType TcrEndpoint::sendRequestWithRetry( } else { error = GF_NOTCON; LOGFINE( - "Returning without connection with %z seconds remaining " + "Returning without connection with %s seconds remaining " "for endpoint %s.", - timeout.count(), m_name.c_str()); + std::to_string(timeout.count()).c_str(), m_name.c_str()); } } else { LOGERROR("Unexpected failure while sending request to server."); diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp index 7444d195c9..db758627ac 100644 --- a/cppcache/src/ThinClientRegion.cpp +++ b/cppcache/src/ThinClientRegion.cpp @@ -3016,19 +3016,21 @@ void ThinClientRegion::executeFunction( rc->clearResults(); failedNodes->clear(); } else if (err == GF_TIMEOUT) { - LOGINFO("function timeout. Name: %s, timeout: %z, params: %" PRIu8 + LOGINFO("function timeout. Name: %s, timeout: %s, params: %" PRIu8 ", " "retryAttempts: %d ", - func.c_str(), timeout.count(), getResult, retryAttempts); + func.c_str(), std::to_string(timeout.count()).c_str(), + getResult, retryAttempts); throwExceptionIfError("ExecuteOnRegion", GF_TIMEOUT); } else if (err == GF_CLIENT_WAIT_TIMEOUT || err == GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA) { LOGINFO( "function timeout, possibly bucket is not available or bucket " - "blacklisted. Name: %s, timeout: %z, params: %" PRIu8 + "blacklisted. Name: %s, timeout: %s, params: %" PRIu8 ", retryAttempts: " "%d ", - func.c_str(), timeout.count(), getResult, retryAttempts); + func.c_str(), std::to_string(timeout.count()).c_str(), getResult, + retryAttempts); throwExceptionIfError("ExecuteOnRegion", GF_CLIENT_WAIT_TIMEOUT); } else { LOGDEBUG("executeFunction err = %d ", err); From eedd82534729fd3e071431793e99b9d833b79030 Mon Sep 17 00:00:00 2001 From: Blake Bender Date: Wed, 13 Nov 2019 10:55:26 -0800 Subject: [PATCH 2/5] GEODE-7447: Fix syntax error --- cppcache/src/EntryExpiryHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp index fc6b76cb1c..e43b71aa45 100644 --- a/cppcache/src/EntryExpiryHandler.cpp +++ b/cppcache/src/EntryExpiryHandler.cpp @@ -63,7 +63,7 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, m_regionPtr->getFullPath().c_str(), std::to_string(curr_time.time_since_epoch().count()).c_str(), std::to_string(lastTimeForExp.time_since_epoch().count()).c_str(), - std::to_string(m_duration.count()).c_str()), + std::to_string(m_duration.count()).c_str(), std::to_string(elapsed.count()).c_str()); if (elapsed >= m_duration) { DoTheExpirationAction(key); From 7e63c7e2e398be02b7477b13db8a2fbb1ba535fb Mon Sep 17 00:00:00 2001 From: Blake Bender Date: Wed, 13 Nov 2019 23:24:18 +0000 Subject: [PATCH 3/5] Fix access violation Co-authored-by Michael Oleske --- cppcache/src/LocalRegion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp index 5c420d1b00..b2e60071cb 100644 --- a/cppcache/src/LocalRegion.cpp +++ b/cppcache/src/LocalRegion.cpp @@ -694,11 +694,13 @@ void LocalRegion::setRegionExpiryTask() { rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask( handler, duration, std::chrono::seconds::zero()); handler->setExpiryTaskId(expiryTaskId); + auto durationStr = std::to_string(duration.count()); + auto expiryTaskIdStr = std::to_string(expiryTaskId); LOGFINE( - "expiry for region [%s], expiry task id = %z, duration = %s, " + "expiry for region [%s], expiry task id = %s, duration = %s, " "action = %d", - m_fullPath.c_str(), expiryTaskId, - std::to_string(duration.count()).c_str(), getRegionExpiryAction()); + m_fullPath.c_str(), expiryTaskIdStr.c_str(), durationStr.c_str(), + getRegionExpiryAction()); } } From 0437e3a02c3460328febce9a6ec1da58d21162fd Mon Sep 17 00:00:00 2001 From: Blake Bender Date: Thu, 14 Nov 2019 18:54:46 +0000 Subject: [PATCH 4/5] GEODE-7447: Use correct version of to_string - also fix up any other discrepancies found between sizeof(type) and %z format specifier --- cppcache/src/ClientMetadataService.cpp | 1 - cppcache/src/EntryExpiryHandler.cpp | 12 ++++++------ cppcache/src/LocalRegion.cpp | 22 ++++++++++++---------- cppcache/src/MapEntry.hpp | 5 +++-- cppcache/src/RegionExpiryHandler.cpp | 9 ++++----- cppcache/src/TcpConn.cpp | 2 +- cppcache/src/TcpSslConn.cpp | 2 +- cppcache/src/TcrConnection.cpp | 5 ++--- cppcache/src/ThinClientRegion.cpp | 6 +++--- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cppcache/src/ClientMetadataService.cpp b/cppcache/src/ClientMetadataService.cpp index 191b9c6e6e..7fca094263 100644 --- a/cppcache/src/ClientMetadataService.cpp +++ b/cppcache/src/ClientMetadataService.cpp @@ -214,7 +214,6 @@ void ClientMetadataService::getBucketServerLocation( LOGDEBUG( "ClientMetadataService::getBucketServerLocation m_regionMetaDataMap " "size is %zu", - m_regionMetaDataMap.size()); std::string path(region->getFullPath()); std::shared_ptr cptr = nullptr; diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp index e43b71aa45..e6d83b41e5 100644 --- a/cppcache/src/EntryExpiryHandler.cpp +++ b/cppcache/src/EntryExpiryHandler.cpp @@ -61,19 +61,19 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, "%s,%s,%s,%s", Utils::nullSafeToString(key).c_str(), m_regionPtr->getFullPath().c_str(), - std::to_string(curr_time.time_since_epoch().count()).c_str(), - std::to_string(lastTimeForExp.time_since_epoch().count()).c_str(), - std::to_string(m_duration.count()).c_str(), - std::to_string(elapsed.count()).c_str()); + to_string(curr_time.time_since_epoch()).c_str(), + to_string(lastTimeForExp.time_since_epoch()).c_str(), + to_string(m_duration).c_str(), to_string(elapsed).c_str()); if (elapsed >= m_duration) { DoTheExpirationAction(key); } else { // reset the task after // (lastAccessTime + entryExpiryDuration - curr_time) in seconds auto remaining = m_duration - elapsed; + auto remainingStr = std::to_string(remaining.count()); LOGDEBUG( - "Resetting expiry task %z secs later for key [%s] of region [%s]", - remaining.count(), Utils::nullSafeToString(key).c_str(), + "Resetting expiry task %s secs later for key [%s] of region [%s]", + remainingStr.c_str(), Utils::nullSafeToString(key).c_str(), m_regionPtr->getFullPath().c_str()); m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask( expProps.getExpiryTaskId(), remaining); diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp index b2e60071cb..a4a911147c 100644 --- a/cppcache/src/LocalRegion.cpp +++ b/cppcache/src/LocalRegion.cpp @@ -110,12 +110,13 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) { // locking not required since setters use atomic operations if (regionExpiryEnabled()) { auto now = std::chrono::system_clock::now(); - LOGDEBUG("Setting last accessed time for region %s to %z", - getFullPath().c_str(), now.time_since_epoch().count()); + auto timeStr = std::to_string(now.time_since_epoch().count()); + LOGDEBUG("Setting last accessed time for region %s to %s", + getFullPath().c_str(), timeStr.c_str()); m_cacheStatistics->setLastAccessedTime(now); if (modified) { - LOGDEBUG("Setting last modified time for region %s to %z", - getFullPath().c_str(), now.time_since_epoch().count()); + LOGDEBUG("Setting last modified time for region %s to %s", + getFullPath().c_str(), timeStr.c_str()); m_cacheStatistics->setLastModifiedTime(now); } // TODO: should we really touch the parent region?? @@ -694,7 +695,7 @@ void LocalRegion::setRegionExpiryTask() { rptr->getCacheImpl()->getExpiryTaskManager().scheduleExpiryTask( handler, duration, std::chrono::seconds::zero()); handler->setExpiryTaskId(expiryTaskId); - auto durationStr = std::to_string(duration.count()); + auto durationStr = to_string(duration); auto expiryTaskIdStr = std::to_string(expiryTaskId); LOGFINE( "expiry for region [%s], expiry task id = %s, duration = %s, " @@ -720,10 +721,11 @@ void LocalRegion::registerEntryExpiryTask( std::shared_ptr key; entry->getKeyI(key); LOGFINEST( - "entry expiry in region [%s], key [%s], task id = %z, " + "entry expiry in region [%s], key [%s], task id = %d, " "duration = %s, action = %d", - m_fullPath.c_str(), Utils::nullSafeToString(key).c_str(), id, - std::to_string(duration.count()).c_str(), getEntryExpirationAction()); + m_fullPath.c_str(), Utils::nullSafeToString(key).c_str(), + static_cast(id), to_string(duration).c_str(), + getEntryExpirationAction()); } expProps.setExpiryTaskId(id); } @@ -2800,12 +2802,12 @@ void LocalRegion::updateAccessAndModifiedTimeForEntry( } LOGDEBUG("Setting last accessed time for key [%s] in region %s to %s", keyStr.c_str(), getFullPath().c_str(), - std::to_string(currTime.time_since_epoch().count()).c_str()); + to_string(currTime.time_since_epoch()).c_str()); expProps.updateLastAccessTime(currTime); if (modified) { LOGDEBUG("Setting last modified time for key [%s] in region %s to %s", keyStr.c_str(), getFullPath().c_str(), - std::to_string(currTime.time_since_epoch().count()).c_str()); + to_string(currTime.time_since_epoch()).c_str()); expProps.updateLastModifiedTime(currTime); } } diff --git a/cppcache/src/MapEntry.hpp b/cppcache/src/MapEntry.hpp index f10a5e09e6..3ac27baf5d 100644 --- a/cppcache/src/MapEntry.hpp +++ b/cppcache/src/MapEntry.hpp @@ -96,8 +96,9 @@ class APACHE_GEODE_EXPORT ExpEntryProperties { inline void cancelExpiryTaskId( const std::shared_ptr& key) const { - LOGDEBUG("Cancelling expiration task for key [%s] with id [%z]", - Utils::nullSafeToString(key).c_str(), m_expiryTaskId); + auto taskIdStr = std::to_string(m_expiryTaskId); + LOGDEBUG("Cancelling expiration task for key [%s] with id [%s]", + Utils::nullSafeToString(key).c_str(), taskIdStr.c_str()); m_expiryTaskManager->cancelTask(m_expiryTaskId); } diff --git a/cppcache/src/RegionExpiryHandler.cpp b/cppcache/src/RegionExpiryHandler.cpp index 3cc9f1f1af..96d2bce152 100644 --- a/cppcache/src/RegionExpiryHandler.cpp +++ b/cppcache/src/RegionExpiryHandler.cpp @@ -57,10 +57,9 @@ int RegionExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, auto elapsed = curr_time - lastTimeForExp; LOGDEBUG("Entered region expiry task handler for region [%s]: %s,%s,%s,%s", m_regionPtr->getFullPath().c_str(), - std::to_string(curr_time.time_since_epoch().count()).c_str(), - std::to_string(lastTimeForExp.time_since_epoch().count()).c_str(), - std::to_string(m_duration.count()).c_str(), - std::to_string(elapsed.count()).c_str()); + to_string(curr_time.time_since_epoch()).c_str(), + to_string(lastTimeForExp.time_since_epoch()).c_str(), + to_string(m_duration).c_str(), to_string(elapsed).c_str()); if (elapsed >= m_duration) { DoTheExpirationAction(); } else { @@ -69,7 +68,7 @@ int RegionExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, // (lastAccessTime + entryExpiryDuration - curr_time) in seconds LOGDEBUG("Resetting expiry task for region [%s] after %s sec", m_regionPtr->getFullPath().c_str(), - std::to_string(remaining.count()).c_str()); + to_string(remaining).c_str()); m_regionPtr->getCacheImpl()->getExpiryTaskManager().resetTask( m_expiryTaskId, remaining); return 0; diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp index 27ba8b96b4..bcd88f742b 100644 --- a/cppcache/src/TcpConn.cpp +++ b/cppcache/src/TcpConn.cpp @@ -211,7 +211,7 @@ void TcpConn::connect() { LOGFINER("Connecting plain socket stream to %s:%d waiting %s micro sec", ipaddr.get_host_name(), ipaddr.get_port_number(), - std::to_string(waitMicroSeconds.count()).c_str()); + to_string(waitMicroSeconds).c_str()); ACE_SOCK_Connector conn; int32_t retVal = 0; diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp index 6921afa355..104b4b46e1 100644 --- a/cppcache/src/TcpSslConn.cpp +++ b/cppcache/src/TcpSslConn.cpp @@ -93,7 +93,7 @@ void TcpSslConn::connect() { LOGDEBUG("Connecting SSL socket stream to %s:%d waiting %s micro sec", m_addr.get_host_name(), m_addr.get_port_number(), - std::to_string(waitMicroSeconds.count()).c_str()); + to_string(waitMicroSeconds).c_str()); int32_t retVal = m_ssl->connect(m_addr, waitMicroSeconds); diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp index c218f19b21..b4ea2cacf8 100644 --- a/cppcache/src/TcrConnection.cpp +++ b/cppcache/src/TcrConnection.cpp @@ -617,7 +617,7 @@ inline ConnErrType TcrConnection::receiveData( readHandshakeString, all call TcrConnection::receiveData. */ LOGDEBUG("TcrConnection::receiveData length = %zu defaultWaitSecs = %s", - length, std::to_string(defaultWaitSecs.count()).c_str()); + length, to_string(defaultWaitSecs).c_str()); if (m_poolDM != nullptr) { LOGDEBUG("TcrConnection::receiveData readBytes = %zu", readBytes); m_poolDM->getStats().incReceivedBytes(static_cast(readBytes)); @@ -647,8 +647,7 @@ inline ConnErrType TcrConnection::sendData( LOGDEBUG( "before send len %zu sendTimeoutSec = %s checkConnected = %d m_connected " "%d", - length, std::to_string(sendTimeout.count()).c_str(), checkConnected, - m_connected); + length, to_string(sendTimeout).c_str(), checkConnected, m_connected); while (length > 0 && sendTimeout > std::chrono::microseconds::zero()) { if (checkConnected && !m_connected) { return CONN_IOERR; diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp index db758627ac..c24af4c534 100644 --- a/cppcache/src/ThinClientRegion.cpp +++ b/cppcache/src/ThinClientRegion.cpp @@ -3598,10 +3598,10 @@ void ChunkedFunctionExecutionResponse::handleChunk( return; } - auto startLen = + auto startLen = static_cast( input.getBytesRead() - - 1; // from here need to look value part + memberid AND -1 for array type - // iread adn gnore array length + 1); // from here need to look value part + memberid AND -1 for array type + // read and ignore array length input.readArrayLength(); // read a byte to determine whether to read exception part for sendException From 021f5b170f66966e7dc969f05b63972b68c59677 Mon Sep 17 00:00:00 2001 From: Blake Bender Date: Fri, 15 Nov 2019 09:05:03 -0800 Subject: [PATCH 5/5] GEODE-7447: Switch remaining calls to our to_string implementation for durations --- cppcache/src/EntryExpiryHandler.cpp | 2 +- cppcache/src/LocalRegion.cpp | 2 +- cppcache/src/TcrEndpoint.cpp | 4 ++-- cppcache/src/ThinClientRegion.cpp | 7 +++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cppcache/src/EntryExpiryHandler.cpp b/cppcache/src/EntryExpiryHandler.cpp index e6d83b41e5..8c1334cbf6 100644 --- a/cppcache/src/EntryExpiryHandler.cpp +++ b/cppcache/src/EntryExpiryHandler.cpp @@ -70,7 +70,7 @@ int EntryExpiryHandler::handle_timeout(const ACE_Time_Value& current_time, // reset the task after // (lastAccessTime + entryExpiryDuration - curr_time) in seconds auto remaining = m_duration - elapsed; - auto remainingStr = std::to_string(remaining.count()); + auto remainingStr = to_string(remaining); LOGDEBUG( "Resetting expiry task %s secs later for key [%s] of region [%s]", remainingStr.c_str(), Utils::nullSafeToString(key).c_str(), diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp index a4a911147c..b4f9fcf8fb 100644 --- a/cppcache/src/LocalRegion.cpp +++ b/cppcache/src/LocalRegion.cpp @@ -110,7 +110,7 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) { // locking not required since setters use atomic operations if (regionExpiryEnabled()) { auto now = std::chrono::system_clock::now(); - auto timeStr = std::to_string(now.time_since_epoch().count()); + auto timeStr = to_string(now.time_since_epoch()); LOGDEBUG("Setting last accessed time for region %s to %s", getFullPath().c_str(), timeStr.c_str()); m_cacheStatistics->setLastAccessedTime(now); diff --git a/cppcache/src/TcrEndpoint.cpp b/cppcache/src/TcrEndpoint.cpp index 8f7666bcbf..0f4b514769 100644 --- a/cppcache/src/TcrEndpoint.cpp +++ b/cppcache/src/TcrEndpoint.cpp @@ -187,7 +187,7 @@ GfErrType TcrEndpoint::createNewConnection( LOGFINE( "TcrEndpoint::createNewConnection: connectTimeout =%s " "m_needToConnectInLock=%d appThreadRequest =%d", - std::to_string(connectTimeout.count()).c_str(), m_needToConnectInLock, + to_string(connectTimeout).c_str(), m_needToConnectInLock, appThreadRequest); GfErrType err = GF_NOERR; newConn = nullptr; @@ -925,7 +925,7 @@ GfErrType TcrEndpoint::sendRequestWithRetry( LOGFINER( "sendRequestWithRetry:: looking for connection in queue timeout = " "%s", - std::to_string(timeout.count()).c_str()); + to_string(timeout).c_str()); // max wait time to get a connection conn = m_opConnections.getUntil(timeout); } diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp index c24af4c534..be95f76406 100644 --- a/cppcache/src/ThinClientRegion.cpp +++ b/cppcache/src/ThinClientRegion.cpp @@ -3019,8 +3019,8 @@ void ThinClientRegion::executeFunction( LOGINFO("function timeout. Name: %s, timeout: %s, params: %" PRIu8 ", " "retryAttempts: %d ", - func.c_str(), std::to_string(timeout.count()).c_str(), - getResult, retryAttempts); + func.c_str(), to_string(timeout).c_str(), getResult, + retryAttempts); throwExceptionIfError("ExecuteOnRegion", GF_TIMEOUT); } else if (err == GF_CLIENT_WAIT_TIMEOUT || err == GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA) { @@ -3029,8 +3029,7 @@ void ThinClientRegion::executeFunction( "blacklisted. Name: %s, timeout: %s, params: %" PRIu8 ", retryAttempts: " "%d ", - func.c_str(), std::to_string(timeout.count()).c_str(), getResult, - retryAttempts); + func.c_str(), to_string(timeout).c_str(), getResult, retryAttempts); throwExceptionIfError("ExecuteOnRegion", GF_CLIENT_WAIT_TIMEOUT); } else { LOGDEBUG("executeFunction err = %d ", err);