The Single.timeout(..) family of operations are part of a class of operations will short-circuit the response based on the cancellation pathway, specifically they will return a TimeoutException down the error path. Because cancellation and the result are intrinsically racy there is currently the possibility that the result will be generated but we cannot return it to the subscriber having already given them an Exception in the error pathway. For values that are stateful this can result in a resource leak. One such leak occurs in the AbstractTimeoutHttpFilter.
Modifications:
Modify the AbstractTimeoutHttpFilter to keep a handle on the resource and make sure we close it if we receive a cancellation. This is a localized fix but appears to be effective.
Motivation:
The Single.timeout(..) family of operations are part of a class of operations will short-circuit the response based on the cancellation pathway, specifically they will return a TimeoutException down the error path. Because cancellation and the result are intrinsically racy there is currently the possibility that the result will be generated but we cannot return it to the subscriber having already given them an Exception in the error pathway. For values that are stateful this can result in a resource leak. One such leak occurs in the AbstractTimeoutHttpFilter.
Modifications:
Modify the AbstractTimeoutHttpFilter to keep a handle on the resource and make sure we close it if we receive a cancellation. This is a localized fix but appears to be effective.
Result:
One less leak.