[JAVA-4523] Buffer is leaked from buffer pool on socket exception Created: 08/Mar/22  Updated: 28/Oct/23  Resolved: 10/Mar/22

Status: Closed
Project: Java Driver
Component/s: Internal
Affects Version/s: None
Fix Version/s: 4.6.0

Type: Bug Priority: Minor - P4
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In SocketStream#read, the ByteBuf is not released if an exception is thrown. As a result the buffer will be GC'd but will not be returned to the buffer pool. This is a performance issue, but also a correctness issue, as it will result in a permit never being released. Eventually, an application could run out of permits (although currently there are Integer#MAX_VALUE permits available so it's unlikely.



 Comments   
Comment by Githook User [ 10/Mar/22 ]

Author:

{'name': 'Jeff Yemin', 'email': 'jeff.yemin@mongodb.com', 'username': 'jyemin'}

Message: Ensure buffer is released on exception in SocketStream#read (#888)

JAVA-4523
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/0bbf4419fc5804f2e7fb3f7f8a0897f120a5e79b

Generated at Thu Feb 08 09:02:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.