Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4538

c client use a static global variable addr_rw_server to save a zhandle's member will cause problem if there are multiple zhandle connecting multiple ZooKeeper ensembles

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • c client
    • None

    Description

       

      Since addr_rw_server is static global, if there are multiple zhandle corresponding to multiple ZooKeeper ensembles(e.g. a.zookeeper.com, b.zookeeper.com), the global addr_rw_server may pointer to address of a.zookeeper.com when we use zhandle of b.zookeeper.com:

      static struct sockaddr_storage *addr_rw_server = 0;
      
      // in ping_rw_server
      addr_rw_server = rc ? &zh->addr_rw_server : 0; 
      
      // in zookeeper_interest
      if (addr_rw_server) {
          zh->addr_cur = *addr_rw_server;
          addr_rw_server = 0;
      } else {
          // No need to delay -- grab the next server and attempt connection
          zoo_cycle_next_server(zh);
      }

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            francishe FrancisHe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: