Today TransportRollupSearchAction uses respondAndRelease to complete a listener which calls TransportChannel#sendResponse directly, representing two decRef() calls. There's a corresponding incRef() call on various branches under processResponse (including the rather twisty RollupResponseTranslator) but it's not obviously correct. Could we improve this? Or at least add a little more javadoc to any non-refcount-neutral methods to document their behaviour?
Also I found that the rollup test suite (e.g. ./gradlew :x-pack:plugin:rollup:check) doesn't really check for refcounting correctness, presumably because it doesn't do enough work to trigger the GC that the LeakDetector needs. I suspect this isn't the only test suite that won't catch bugs in this area. Can we do something to make our tests catch this sort of stuff more reliably?
Today
TransportRollupSearchAction
usesrespondAndRelease
to complete a listener which callsTransportChannel#sendResponse
directly, representing twodecRef()
calls. There's a correspondingincRef()
call on various branches underprocessResponse
(including the rather twistyRollupResponseTranslator
) but it's not obviously correct. Could we improve this? Or at least add a little more javadoc to any non-refcount-neutral methods to document their behaviour?Also I found that the rollup test suite (e.g.
./gradlew :x-pack:plugin:rollup:check
) doesn't really check for refcounting correctness, presumably because it doesn't do enough work to trigger the GC that theLeakDetector
needs. I suspect this isn't the only test suite that won't catch bugs in this area. Can we do something to make our tests catch this sort of stuff more reliably?