[JAVA-335] all connections to a server should get closed under certain types of exception Created: 21/Apr/11  Updated: 14/Jun/11  Resolved: 27/May/11

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

Type: Improvement Priority: Major - P3
Reporter: Antoine Girbal Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by JAVA-290 mongo driver should check whether soc... Closed

 Description   

Ryan reported seeing write exceptions to primary after bouncing both mongod servers.
I think the reason why you still get an exception from the primary is because we do not clean up all connections upon 1 failure.
Say you take down primary, 1 write may fail to it and make driver switch to the secondary (new primary).
All the connections to the old primary are dead but not marked as such.
When eventually driver switches back to 1st primary, it will use dead connections and that will make some write fail.
Usually dead connections are cleaned up quickly by reads since they retry 2 times.
I think we should close all connections to a host in case of certain exceptions (RST) AND a new master is elected, to avoid these errors.
There is a function in driver that does it but it's not wired in.



 Comments   
Comment by Antoine Girbal [ 27/May/11 ]

resolved but still need to test

Comment by auto [ 27/May/11 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: JAVA-335: all connections to a server should get closed under certain types of exception
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/8eaa84a89f180c6346b4a509a6b73078a59f9a26

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