availableSharedCapacity will be slowly exhausted#9394
Conversation
Without this line of code(Line390):this.head.reclaimSpace(LINK_CAPACITY); availableSharedCapacity will gradually be exhausted, eventually leading to reserveSpace (int space) returning false and Recycler will completely invalid.
|
Can one of the admins verify this patch? |
|
@YuanHuCoding would it be possible to add a unit test ? |
|
My test scenario is as follows: 1)Construct Recycler without discarding any objects: 2)Submit the recovery operation through a single thread pool: 3)Statistics of all the creation of new objects, objects recycled, objects discarded. You'll find out availableSharedCapacity will gradually be exhausted, eventually leading to reserveSpace (int space) returning false and Recycler will completely invalid. |
|
@netty-bot test this please |
|
@YuanHuCoding can you also sign our icla and let me know once done: |
|
` public class Test_Recycler_availableSharedCapacity { ` If you add that line of code:this.head.reclaimSpace(LINK_CAPACITY);,The number of new objects created has been greatly reduced. You can also use the version I added statistics to make it easier to see the problem. The test results are as follows: If you add that line of code:this.head.reclaimSpace(LINK_CAPACITY); |
|
@YuanHuCoding thanks a lot...great catch! |
… reclaimSpace(...) call (#9394) Motivation: We did miss to call reclaimSpace(...) in one case which can lead to the situation of having the Recycler to not correctly reclaim space and so just create new objects when not needed. Modifications: Correctly call reclaimSpace(...) Result: Recycler correctly reclaims space in all situations.
Without this line of code(Line390):this.head.reclaimSpace(LINK_CAPACITY);
availableSharedCapacity will gradually be exhausted, eventually leading to reserveSpace (int space) returning false and Recycler will completely invalid.