Memory traces of steady state with mininet have shown we are retaining
already-completed callbacks for the duration of the OutboundQueueImpl's
generation. For multipart requests that means we end up holding up large
chunks of memory for extended time, leading to unacceptable memory
pressure which can be easily avoided.
Change-Id: I2a980fc454583e8fb5d7fe44e47d7ddf076c650b
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
6b6700b60e2db29fdb23d2044ab254accf86ecc9)
completed = reallyComplete;
if (callback != null) {
callback.onSuccess(response);
completed = reallyComplete;
if (callback != null) {
callback.onSuccess(response);
+ if (reallyComplete) {
+ // We will not need the callback anymore, make sure it can be GC'd
+ callback = null;
+ }
}
LOG.debug("Entry {} completed {} with response {}", this, completed, response);
return reallyComplete;
}
LOG.debug("Entry {} completed {} with response {}", this, completed, response);
return reallyComplete;
completed = true;
if (callback != null) {
callback.onFailure(cause);
completed = true;
if (callback != null) {
callback.onFailure(cause);
}
} else {
LOG.warn("Ignoring failure {} for completed message", cause);
}
}
}
} else {
LOG.warn("Ignoring failure {} for completed message", cause);
}
}