[JAVA-315] several exception cases do not put back the dbport in pool, resulting in forever hanging pool to that server Created: 31/Mar/11  Updated: 08/Apr/11  Resolved: 06/Apr/11

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

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

Issue Links:
Related

 Description   

we are not properly having port.done() in a finally close.
There are at least 2 spots where port is not properly put back in pool.

One spot is pretty obvious:

  • in DBTCPConnector.call(), if there is any ioexception during call, then _error() is called
  • in _error(), does a checkMaster(), which will throw an exception if there is no new master
  • due to this exception, the following mp.error() is not called, so port is not put back in pool.
    Consequently if you have a replset, and master dies but it takes some time to elect new master, any find operation will take away a port from pool.
    You just need 10 find calls to make pool unusable for that server, until the application is restarted.

Other spot:

  • in DBTCPConnector.say(), in case that there is a writeconcern, getlasterror() is called
  • if there is ioexception in getlasterror, it is converted into mongoexception
  • the catch block of mongoexception does not put port back in pool.
    Consequently if you have any ioexception in during the getlasterror call, the port will get lost.


 Comments   
Comment by auto [ 31/Mar/11 ]

Author:

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

Message: JAVA-315: several exception cases do not put back the dbport in pool, resulting in forever hanging pool to that server
JAVA-316: in DBTCPConnector.say(), possible race condition that affects getLastError() result
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/143dce3ecbfdcd644de8b129d9db8c275c99017e

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