Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-7269

cbtransfer/cbrestore throws BadStatusLine exception when using wrong port number

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1.0
    • Component/s: tools
    • Security Level: Public
    • Labels:
      None
    • Sprint:
      PCI Team - Sprint 4, PCI Team - Sprint 5, PCI Team - Sprint 7

      Description

      Thanks to Tony Fonager....

      When cbtransfer is invoked incorrectly against the wrong port (11211 rather than 8091), the tool should give a more polite, useful error message rather than an ugly stack trace.

      [root@cbnode05 bin]# ./cbtransfer /root/Backup/cbtransfer http://192.168.0.75:11211 -b quizmo -B quizmo -u username -p password
      Traceback (most recent call last):
      File "/opt/couchbase/lib/python/cbtransfer", line 33, in <module>
      pump_transfer.exit_handler(pump_transfer.Transfer().main(sys.argv))
      File "/opt/couchbase/lib/python/pump_transfer.py", line 85, in main
      sink_class, sink).run()
      File "/opt/couchbase/lib/python/pump.py", line 100, in run
      rv, source_map, sink_map = self.check_endpoints()
      File "/opt/couchbase/lib/python/pump.py", line 150, in check_endpoints
      rv, sink_map = self.sink_class.check(self.opts, self.sink_spec, source_map)
      File "/opt/couchbase/lib/python/pump_cb.py", line 71, in check
      rv, sink_map = pump.rest_couchbase(opts, spec)
      File "/opt/couchbase/lib/python/pump.py", line 879, in rest_couchbase
      rest_request_json(host, int(port), user, pswd, path)
      File "/opt/couchbase/lib/python/pump.py", line 856, in rest_request_json
      reason=reason)
      File "/opt/couchbase/lib/python/pump.py", line 829, in rest_request
      resp = conn.getresponse()
      File "/usr/lib64/python2.6/httplib.py", line 990, in getresponse
      response.begin()
      File "/usr/lib64/python2.6/httplib.py", line 391, in begin
      version, status, reason = self._read_status()
      File "/usr/lib64/python2.6/httplib.py", line 355, in _read_status
      raise BadStatusLine(line)
      httplib.BadStatusLine

        Activity

        Hide
        bcui Bin Cui added a comment -

        Unfortunately, the answer is no.
        Since 11211 is a a valid port number, but reserved for moxi instead of for ns_server, so we connect moxi instead.

        Talked to steve about this issue. He suggested it is a low priority bug. Two options to solve this problem:
        1. implement a timeout for this operation, which is preferred way
        2. check out upfront about this port number. this is not recommended because we don't want to hard code any port number in our logic.

        All in all, this is a edge case.

        Show
        bcui Bin Cui added a comment - Unfortunately, the answer is no. Since 11211 is a a valid port number, but reserved for moxi instead of for ns_server, so we connect moxi instead. Talked to steve about this issue. He suggested it is a low priority bug. Two options to solve this problem: 1. implement a timeout for this operation, which is preferred way 2. check out upfront about this port number. this is not recommended because we don't want to hard code any port number in our logic. All in all, this is a edge case.
        Hide
        maria Maria McDuff (Inactive) added a comment -

        per bug triage, #1 is fine to implement.

        Show
        maria Maria McDuff (Inactive) added a comment - per bug triage, #1 is fine to implement.
        Hide
        bcui Bin Cui added a comment -

        Thought over again, the option one is still not good and clear enough.
        First, after a timeout, we still cannot clearly tell customers that the port number is incorrect for cbtransfer tool to use. And timeout may be caused by other issues too.
        Second, we have a clear context that these ports are reserved for moxi service and by no means used as REST api calls. We can identify it and give customers an accurate
        answers for the input error.

        http://review.couchbase.org/#/c/26301/

        Show
        bcui Bin Cui added a comment - Thought over again, the option one is still not good and clear enough. First, after a timeout, we still cannot clearly tell customers that the port number is incorrect for cbtransfer tool to use. And timeout may be caused by other issues too. Second, we have a clear context that these ports are reserved for moxi service and by no means used as REST api calls. We can identify it and give customers an accurate answers for the input error. http://review.couchbase.org/#/c/26301/
        Hide
        maria Maria McDuff (Inactive) added a comment -

        pls verify / close.

        Show
        maria Maria McDuff (Inactive) added a comment - pls verify / close.
        Hide
        shashank Shashank Gupta added a comment -

        Verified with build 2.0.2-809

        Show
        shashank Shashank Gupta added a comment - Verified with build 2.0.2-809

          People

          • Assignee:
            shashank Shashank Gupta
            Reporter:
            steve Steve Yen
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Agile

                Gerrit Reviews

                There is 1 open Gerrit change