Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3878

Replication: stopSlave does not close serversocket when master has crashed.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4.2.0
    • Fix Version/s: 10.4.2.1, 10.5.1.1
    • Component/s: Replication
    • Labels:
      None
    • Issue & fix info:
      Newcomer

      Description

      The stopSlave command (connection URL attribute) fails to close the ServerSocket when called after master database has crashed. Because of this, the same Derby instance cannot later start a slave on the same port.

      The problem is in ReplicationMessageReceive#tearDown and SocketConnection#tearDown:

      SC#tearDown:
      When objOutputStream is closed, the stream's flush method is called. Flush throws an exception, and socket.close is not called.

      RMR#tearDown:
      When socketCon.teardown throws an exception, serverSocket.close is not called.

      Suggested fix: add try/catch/finally blocks so that vital code (socket.close and serverSocket.close) is always called.

      Note that the stop slave command can also come from the master (if stopMaster connection URL is called), in which case this bug will not materialize.

        Attachments

        1. d3878-suggested-fix.diff
          2 kB
          Knut Anders Hatlen
        2. d3878-with-comments.diff
          2 kB
          Knut Anders Hatlen

          Issue Links

            Activity

              People

              • Assignee:
                knutanders Knut Anders Hatlen
                Reporter:
                jorgenlo Jorgen Loland
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: