Solr
  1. Solr
  2. SOLR-5721

ConnectionManager can become stuck in likeExpired

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.6.1
    • Fix Version/s: 4.7, 5.0
    • Component/s: SolrCloud
    • Labels:
      None

      Description

      Here are the sequence of events:

      • we disconnect
      • The disconnect timer beings to run (so no longer scheduled), but doesn't set likelyExpired yet
      • We connect, and set likelyExpired = false
      • The disconnect thread runs and sets likelyExpired to true, and it is never set back to false (note that we cancel the disconnect thread but that only cancels scheduled tasks but not running tasks).

      This is pretty difficult to reproduce without doing more work in the disconnect thread. It's easy to reproduce by adding sleeps in various places – I have a test that I'll attach that does that.

      The most straightforward way to solve this would be to grab the synchronization lock on ConnectionManager in the disconnect thread, ensure we aren't actually connected, and only then setting likelyExpired to true. In code:

      synchronized (ConnectionManager.this) {
        if (!connected) likelyExpired = true;
      }
      

      but this is all pretty subtle and error prone. It's easier to just get rid of the disconnect thread and record the last time we disconnected. Then, when we check likelyExpired, we just do a quick calculation to see if we are likelyExpired.

      1. SOLR-5721test.patch
        4 kB
        Gregory Chanan
      2. SOLR-5721.patch
        7 kB
        Gregory Chanan

        Activity

        Gregory Chanan created issue -
        Gregory Chanan made changes -
        Field Original Value New Value
        Attachment SOLR-5721test.patch [ 12628616 ]
        Gregory Chanan made changes -
        Attachment SOLR-5721.patch [ 12628633 ]
        Mark Miller made changes -
        Assignee Mark Miller [ markrmiller@gmail.com ]
        Fix Version/s 5.0 [ 12321664 ]
        Fix Version/s 4.7 [ 12325573 ]
        Affects Version/s 4.6.1 [ 12325762 ]
        Affects Version/s 5.0 [ 12321664 ]
        Affects Version/s 4.7 [ 12325573 ]
        Mark Miller made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        David Smiley made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Mark Miller
            Reporter:
            Gregory Chanan
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development