[SERVER-28239] Fix double ticket holder release in transport layer legacy during primary step down Created: 07/Mar/17  Updated: 25/Jun/18  Resolved: 08/Mar/17

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 3.4.0, 3.5.1
Fix Version/s: 3.4.3, 3.5.5

Type: Bug Priority: Critical - P2
Reporter: Mira Carey Assignee: Mira Carey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-30311 re-enable TL Legacy endSessionsDoesnt... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.4
Sprint: Platforms 2017-03-27
Participants:
Case:

 Description   

During a primary step down, we call _closeConnection on all matching sessions. This kicks those sessions out of sourceMessage, which causes them to explicitly call end(), which calls _closeConnection. _closeConnection calls globalTicketHolder.release().

This causes us to double release on primary step down, which causes us to increase the effective number of tickets in the system.

This behavior is most noticeable when looking at the 'now open' number of connections in the main init and listen thread, where the 'outof' param stays steady at the desired number of connections, but the 'available' amount increases. This causes us to report negative numbers of open connections.



 Comments   
Comment by Githook User [ 08/Mar/17 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-28239 Disabling transport layer legacy test

Disabling test until we can allocate port numbers safely for unit tests

(cherry picked from commit f8f26d50a9a14e7d269f878e239991d73ff4864a)
Branch: v3.4
https://github.com/mongodb/mongo/commit/6ce1c2d27b8f372748968d973eebbc78194d9bb1

Comment by Githook User [ 08/Mar/17 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-28239 fix double close in ticket holder

The legacy transport layer allowed end() to be called multiple times on
the same session, which would incorrectly double close + double
increment the ticket holder. This occured during primary step down, as
endAllSessions was called (which called end()) and then the owning
threads called end() as they finished.

Fix involves a mutex per connection and a check for _closed in
closeConnection.

(cherry picked from commit b1ec4cfbb535ddc7ee741a76132fee67a3ab1d1e)
Branch: v3.4
https://github.com/mongodb/mongo/commit/5043299e1578e1248c35ba0a83be0c841a16fa92

Comment by Githook User [ 08/Mar/17 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-28239 Disabling transport layer legacy test

Disabling test until we can allocate port numbers safely for unit tests
Branch: master
https://github.com/mongodb/mongo/commit/f8f26d50a9a14e7d269f878e239991d73ff4864a

Comment by Githook User [ 08/Mar/17 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-28239 fix double close in ticket holder

The legacy transport layer allowed end() to be called multiple times on
the same session, which would incorrectly double close + double
increment the ticket holder. This occured during primary step down, as
endAllSessions was called (which called end()) and then the owning
threads called end() as they finished.

Fix involves a mutex per connection and a check for _closed in
closeConnection.
Branch: master
https://github.com/mongodb/mongo/commit/b1ec4cfbb535ddc7ee741a76132fee67a3ab1d1e

Generated at Thu Feb 08 04:17:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.