You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "Blake Bender (Jira)" <ji...@apache.org> on 2021/04/26 16:40:00 UTC
[jira] [Created] (GEODE-9193) PING message "leaked" at shutdown due
to bad singleton implementation
Blake Bender created GEODE-9193:
-----------------------------------
Summary: PING message "leaked" at shutdown due to bad singleton implementation
Key: GEODE-9193
URL: https://issues.apache.org/jira/browse/GEODE-9193
Project: Geode
Issue Type: Bug
Components: native client
Reporter: Blake Bender
There is a micro-optimization in the native client to prevent creating and tearing down PING messages multiple times, since this message always has the same format. Unfortunately, the implementation uses a pointer, rather than a reference, so exactly one instance of TcrMessagePing is allocated on the heap, and the object is never deleted, making it appear as a leak in any leak-tracking tool.
```
TcrMessagePing* TcrMessage::getPingMessage(CacheImpl* cacheImpl) {
static auto pingMsg =
new TcrMessagePing(new DataOutput(cacheImpl->createDataOutput()), true);
return pingMsg;
}
```
Changing this from a pointer to a const reference will allow the object to be destructed properly at shutdown.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)