[JAVA-2077] Java Driver may invalidate connectionPool twice for the an exception Created: 07/Jan/16  Updated: 11/Sep/19  Resolved: 10/Jan/16

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

Type: Task Priority: Major - P3
Reporter: Yize Li [X] Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

In DefaultConnectionPool.java a pooled connection invalidate the connection pool by invoking incrementGenerationAndOnSocketException and then propagate it to upper level. Then in DefaultServer.java, ProtocolExcecutor catches the exception and invalidate the connection pool again. I don't know why it is like that.



 Comments   
Comment by Jeffrey Yemin [ 10/Jan/16 ]

Thanks for pointing this out, but since it's not causing any problems I don't see a reason to change anything.

Comment by Yize Li [X] [ 09/Jan/16 ]

Hi Jeff,

I agree. Users could hardly feel the effects.

Comment by Jeffrey Yemin [ 08/Jan/16 ]

Hi Yize Li,

It's not intentional that it's like that, but I also don't think it's causing any user-visible effects. Do you agree?

Regards,
Jeff

Comment by Yize Li [X] [ 08/Jan/16 ]

Hi Ross,

I checked the source code of master branch and 3.2.x, They are the same in this case. DefaultServerProtocolExecutor invokes handleThrowable in DefaultServer.java when it catches a MongoException and then invokes invalidate if the exception is a SocketException, and PoolConnection in DefaultConnectionPool.java does the same thing by calling incrementGeneartionOnSocketException.

Comment by Ross Lawley [ 07/Jan/16 ]

Hi YizeLi,

Thanks for the ticket - I copied your comment into the description.

Can you confirm what version of the driver you are using?

Ross

Comment by Yize Li [X] [ 07/Jan/16 ]

Sorry for the bad title and the lack of description. My bad.
In DefaultConnectionPool.java a pooled connection invalidate the connection pool by invoking incrementGenerationAndOnSocketException and then propagate it to upper level. Then in DefaultServer.java, ProtocolExcecutor catches the exception and invalidate the connection
pool again. I don't know why it is like that.

Generated at Thu Feb 08 08:56:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.