<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>can you send here the requests sent by kamailio for the two
      mongodb versions? To compare and see where it can be fixed.</p>
    <p>Also, were you using the same mongoc library version in both
      cases?</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 26.02.18 12:57, Stephane wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+UObv=te--v56CS2u+DA=Z7kCG6--KEq1jNqb_0mJpVNwCN7Q@mail.gmail.com">
      <div dir="ltr">Hello,
        <div>I made some additional tests. </div>
        <div>The problem is only present when kamailio is facing mongo
          release 3.2 (or higher). </div>
        <div>With mongo version 3.0 (or lower), the request sent by
          kamailio is different: it contains $query and $table_version
          elements and mongo accepts it.</div>
        <div>Kind regards,<br>
        </div>
        <div>Stephane</div>
        <div><br>
        </div>
        <div class="gmail_extra">
          <div class="gmail_quote">On 23 February 2018 at 10:48,
            Stephane <span dir="ltr"><<a
                href="mailto:mandalavoip@gmail.com" target="_blank"
                moz-do-not-send="true">mandalavoip@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Hello Daniel,
                <div><br>
                </div>
                <div>I took a pcap trace. And I see the following in the
                  answer sent by mongo</div>
                <div><br>
                </div>
                <div>Failed to parse: { find: "version", filter: {
                  table_name: "location" }, table_version: 1, $db:
                  "kamailio", $readPreference: { mode:
                  "primaryPreferred" }, $clusterTime: { clusterTime:
                  Timestamp(1519379980, 1), signature: { hash:
                  BinData(0, 000000000000000000000000000000<wbr>0000000000),
                  keyId: 0 } } }. Unrecognized field
                  'table_version'.code<span style="white-space:pre-wrap">       </span>codeNameFailedToParseoperation<wbr>TimeZ$<wbr>clusterTimeXclusterTimeZsignat<wbr>ure3hashkeyId</div>
                <div><br>
                </div>
                <div>Kind regards,</div>
                <div>Stephane</div>
              </div>
              <div class="HOEnZb">
                <div class="h5">
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On 23 February 2018 at
                      09:39, Daniel-Constantin Mierla <span dir="ltr"><<a
                          href="mailto:miconda@gmail.com"
                          target="_blank" moz-do-not-send="true">miconda@gmail.com</a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        <div text="#000000" bgcolor="#FFFFFF">
                          <p>Hello,</p>
                          <p>I don't know if you can see the result sent
                            back by mongodb in its logs, it doesn't show
                            it there. Maybe you can sniff the traffic on
                            the network and see if mongodb sends the
                            proper response back. Kamailio logs like
                            nothing was retrieved.<br>
                          </p>
                          <p>Cheers,<br>
                            Daniel<br>
                          </p>
                          <div>
                            <div class="m_6111474070442354138h5"> <br>
                              <div
                                class="m_6111474070442354138m_17351067677194617moz-cite-prefix">On
                                22.02.18 18:02, Stephane Focant wrote:<br>
                              </div>
                            </div>
                          </div>
                          <blockquote type="cite">
                            <div>
                              <div class="m_6111474070442354138h5">
                                <div dir="ltr">
                                  <div>Hello,</div>
                                  <div>I have an issue when I try to use
                                    kamailio 5.1 with usrloc and
                                    db_mongdb modules.</div>
                                  <div>When I try to start kamailio, I
                                    get the following error:</div>
                                  <div><br>
                                  </div>
                                  <div>0(22216) DEBUG: <core>
                                    [db.c:314]: db_do_init2():
                                    connection 0x7f735b5c4100 not found
                                    in pool</div>
                                  <div> 0(22216) DEBUG: db_mongodb
                                    [mongodb_connection.c:55]:
                                    db_mongodb_new_connection():
                                    connection open to: mongodb://<a
                                      href="http://10.0.12.149"
                                      target="_blank"
                                      moz-do-not-send="true">10.0.12.149</a>,10.0.12.<wbr>150,<a
href="http://10.0.12.151/kamailio?replicaSet=sre_location&slaveOk=true&readPreference=primaryPreferred"
                                      target="_blank"
                                      moz-do-not-send="true">10.0.12.151/kamailio?repli<wbr>caSet=sre_location&slaveOk=<wbr>true&readPreference=primaryPre<wbr>ferred</a></div>
                                  <div> 0(22216) DEBUG: db_mongodb
                                    [mongodb_dbase.c:864]:
                                    db_mongodb_query(): query to
                                    collection [version]</div>
                                  <div> 0(22216) DEBUG: db_mongodb
                                    [mongodb_dbase.c:898]:
                                    db_mongodb_query(): query filter: {
                                    "table_name" : "location" }</div>
                                  <div> 0(22216) DEBUG: db_mongodb
                                    [mongodb_dbase.c:917]:
                                    db_mongodb_query(): columns filter:
                                    { "table_version" : 1 }</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [db_res.c:120]: db_new_result():
                                    allocate 56 bytes for result set at
                                    0x7f735b5c4450</div>
                                  <div> 0(22216) DEBUG: db_mongodb
                                    [mongodb_dbase.c:746]:
                                    db_mongodb_store_result(): no result
                                    from mongodb</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [db.c:404]: db_table_version(): no
                                    row for table location found</div>
                                  <div> 0(22216) ERROR: <core>
                                    [db.c:450]:
                                    db_check_table_version(): invalid
                                    version 0 for table location found,
                                    expected 9 (check table structure
                                    and table "version")</div>
                                  <div> 0(22216) ERROR: usrloc
                                    [dlist.c:659]: register_udomain():
                                    error during table version check.</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [db_pool.c:100]: pool_remove():
                                    removing connection from the pool</div>
                                  <div> 0(22216) ERROR: registrar
                                    [registrar.c:651]: domain_fixup():
                                    failed to register domain</div>
                                  <div> 0(22216) ERROR: <core>
                                    [core/route.c:1154]: fix_actions():
                                    fixing failed (code=-1) at
                                    cfg:/usr/local/kamailio-5.1/et<wbr>c/kamailio/kamailio.cfg:660</div>
                                  <div> 0(22216) ERROR: <core>
                                    [core/rvalue.c:3860]:
                                    fix_rval_expr(): failure in cfg at
                                    line: 660 col: 22</div>
                                  <div> 0(22216) ERROR: <core>
                                    [core/rvalue.c:3860]:
                                    fix_rval_expr(): failure in cfg at
                                    line: 660 col: 22</div>
                                  <div> 0(22216) ERROR: <core>
                                    [core/route.c:1154]: fix_actions():
                                    fixing failed (code=-1) at
                                    cfg:/usr/local/kamailio-5.1/et<wbr>c/kamailio/kamailio.cfg:663</div>
                                  <div>ERROR: error -1 while trying to
                                    fix configuration</div>
                                  <div> 0(22216) DEBUG: tm
                                    [t_funcs.c:85]: tm_shutdown(): start</div>
                                  <div> 0(22216) DEBUG: tm
                                    [t_funcs.c:88]: tm_shutdown():
                                    emptying hash table</div>
                                  <div> 0(22216) DEBUG: tm
                                    [t_funcs.c:90]: tm_shutdown():
                                    removing semaphores</div>
                                  <div> 0(22216) DEBUG: tm
                                    [t_funcs.c:92]: tm_shutdown():
                                    destroying tmcb lists</div>
                                  <div> 0(22216) DEBUG: tm
                                    [t_funcs.c:95]: tm_shutdown(): done</div>
                                  <div> 0(22216) INFO: <core>
                                    [core/sctp_core.c:53]:
                                    sctp_core_destroy(): SCTP API not
                                    initialized</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [core/mem/shm.c:261]:
                                    shm_destroy_manager(): destroying
                                    memory manager: q_malloc</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [core/mem/q_malloc.c:1165]:
                                    qm_shm_lock_destroy(): destroying
                                    the shared memory lock</div>
                                  <div> 0(22216) DEBUG: <core>
                                    [core/mem/pkg.c:91]:
                                    pkg_destroy_manager(): destroying
                                    memory manager: q_malloc</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>In mongoDB, I have the collection
                                    "version" in the db kamailio, and
                                    the entries needed for usrloc
                                    (location and location_attrs):</div>
                                  <div>sre_location:PRIMARY> use
                                    kamailio</div>
                                  <div>switched to db kamailio</div>
                                  <div>sre_location:PRIMARY>
                                    db.getCollection("version").fi<wbr>nd()</div>
                                  <div>{ "_id" :
                                    ObjectId("5a8ec43c601b262bef82<wbr>a595"),
                                    "table_name" : "location",
                                    "table_version" : 9 }</div>
                                  <div>{ "_id" :
                                    ObjectId("5a8edb72a3ec40427577<wbr>b8d0"),
                                    "table_name" : "location_attrs",
                                    "table_version" : 1 }</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>And logs in mongo show the
                                    following info when kamailio starts:</div>
                                  <div><br>
                                  </div>
                                  <div>2018-02-22T17:13:02.604+0100 I
                                    NETWORK  [conn90] received client
                                    metadata from <a
                                      href="http://10.0.12.180:56320"
                                      target="_blank"
                                      moz-do-not-send="true">10.0.12.180:56320</a>
                                    conn: { driver: { name: "mongoc",
                                    version: "1.9.2" }, os: { type:
                                    "Linux", name: "CentOS", version:
                                    "6.9 (Final)", architecture:
                                    "x86_64" }, platform: "cfg=0x1563000
                                    posix=200809 CC=GCC 4.4.7 20120313
                                    (Red Hat 4.4.7-18) CFLAGS=""
                                    LDFLAGS=""" }</div>
                                  <div>2018-02-22T17:13:02.604+0100 I
                                    COMMAND  [conn90] command admin.$cmd
                                    command: isMaster { isMaster: 1,
                                    client: { driver: { name: "mongoc",
                                    version: "1.9.2" }, os: { type:
                                    "Linux", name: "CentOS", version:
                                    "6.9 (Final)", architecture:
                                    "x86_64" }, platform: "cfg=0x1563000
                                    posix=200809 CC=GCC 4.4.7 20120313
                                    (Red Hat 4.4.7-18) CFLAGS=""
                                    LDFLAGS=""" }, compression: [],
                                    $readPreference: { mode:
                                    "secondaryPreferred" }, $db: "admin"
                                    } numYields:0 reslen:716 locks:{}
                                    protocol:op_query 0ms</div>
                                  <div>2018-02-22T17:13:02.604+0100 I
                                    COMMAND  [conn90] command
                                    kamailio.$cmd command: find { find:
                                    "version", filter: { table_name:
                                    "location" }, table_version: 1, $db:
                                    "kamailio", $readPreference: { mode:
                                    "primaryPreferred" }, $clusterTime:
                                    { clusterTime: Timestamp(1519315979,
                                    1), signature: { hash: BinData(0,
                                    000000000000000000000000000000<wbr>0000000000),
                                    keyId: 0 } } } numYields:0
                                    reslen:531 locks:{} protocol:op_msg
                                    0ms</div>
                                  <div>2018-02-22T17:13:02.605+0100 I
                                    NETWORK  [conn90] end connection <a
                                      href="http://10.0.12.180:56320"
                                      target="_blank"
                                      moz-do-not-send="true">10.0.12.180:56320</a>
                                    (9 connections now open)</div>
                                  <div><br>
                                  </div>
                                  <div>I probably miss something: it is
                                    not clear to me why kamailio is not
                                    able to retrieve the value of
                                    table_version for the table_name
                                    location. Any idea would be very
                                    welcome !</div>
                                  <div><br>
                                  </div>
                                  <div>I use mongo-c-driver 1.9.2 and
                                    mongodb 3.6</div>
                                  <div><br>
                                  </div>
                                  <div>Thank you.</div>
                                  <div>Stephane</div>
                                </div>
                                <br>
                                <fieldset
                                  class="m_6111474070442354138m_17351067677194617mimeAttachmentHeader"></fieldset>
                                <br>
                              </div>
                            </div>
                            <pre>______________________________<wbr>_________________
Kamailio (SER) - Users Mailing List
<a class="m_6111474070442354138m_17351067677194617moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a class="m_6111474070442354138m_17351067677194617moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><span class="m_6111474070442354138HOEnZb"><font color="#888888">
</font></span></pre>
                            <span class="m_6111474070442354138HOEnZb"><font
                                color="#888888"> </font></span></blockquote>
                          <span class="m_6111474070442354138HOEnZb"><font
                              color="#888888"> <br>
                              <pre class="m_6111474070442354138m_17351067677194617moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="m_6111474070442354138m_17351067677194617moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="m_6111474070442354138m_17351067677194617moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - March 5-7, 2018, Berlin - <a class="m_6111474070442354138m_17351067677194617moz-txt-link-abbreviated" href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="m_6111474070442354138m_17351067677194617moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a></pre>
                            </font></span></div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - March 5-7, 2018, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>