Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2576

segmentation fault occurred at _mongoc_cluster_run_ismaster()

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.9.4
    • Affects Version/s: 1.9.0
    • Component/s: libmongoc
    • Environment:
      OS : Red Hat Enterprise Linux Server release 7.1 (Maipo)

      file "mongoc-cluster.c"
      function "_mongoc_cluster_run_ismaster"

      721 sd = _mongoc_stream_run_ismaster (
      722 cluster, node->stream, node->connection_address, server_id);
      723
      724 if (sd->type == MONGOC_SERVER_UNKNOWN) {

      This code stores some value in the variable "sd", and uses "sd->type" in the if statement.
      But, when "sd" is NULL, segmentation fault occurred at the if statement.

      At v1.9.3, some decisions are added to the function "_mongoc_stream_run_ismaster",
      and the function returns NULL when it violates the condition.
      These decisions are not implemented at v1.8.2, so this problem not happened at v1.8.2.

      back trace log:

      #0  0x00007f145c7a7e22 in _mongoc_cluster_run_ismaster (cluster=0x238b318,
          node=0x23ab1c0, server_id=1, error=0x7ffffc692480)
          at src/mongoc/mongoc-cluster.c:724
      #1  0x00007f145c7a9923 in _mongoc_cluster_add_node (cluster=0x238b318,
          server_id=1, error=0x7ffffc692480) at src/mongoc/mongoc-cluster.c:1489
      #2  0x00007f145c7aa2c5 in mongoc_cluster_fetch_stream_pooled (
          cluster=0x238b318, server_id=1, reconnect_ok=true, error=0x7ffffc692480)
          at src/mongoc/mongoc-cluster.c:1834
      #3  0x00007f145c7a9c0d in _mongoc_cluster_stream_for_server (
          cluster=0x238b318, server_id=1, reconnect_ok=true, error=0x7ffffc692480)
          at src/mongoc/mongoc-cluster.c:1601
      #4  0x00007f145c7aa627 in _mongoc_cluster_stream_for_optype (
          cluster=0x238b318, optype=MONGOC_SS_READ, read_prefs=0x0,
          error=0x7ffffc692480) at src/mongoc/mongoc-cluster.c:1981
      #5  0x00007f145c7aa65e in mongoc_cluster_stream_for_reads (cluster=0x238b318,
          read_prefs=0x0, error=0x7ffffc692480) at src/mongoc/mongoc-cluster.c:2011
      #6  0x00007f145c7a3771 in _mongoc_client_command_with_opts (client=0x238b310,
          db_name=0x23aaa88 "my_db", command=0x7ffffc692300,
          mode=MONGOC_CMD_READ, opts=0x0, flags=MONGOC_QUERY_NONE,
          default_prefs=0x0, default_rc=0x0, default_wc=0x0, reply=0x7ffffc692280,
          error=0x7ffffc692480) at src/mongoc/mongoc-client.c:1778
      #7  0x00007f145c7baa24 in mongoc_database_command_simple (database=0x23aaa80,
          command=0x7ffffc692300, read_prefs=0x0, reply=0x7ffffc692280,
          error=0x7ffffc692480) at src/mongoc/mongoc-database.c:214
      

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            cos Yuichi Ogino
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: