Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-159

memleak on failed host resolving

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 0.1.5
    • Affects Version/s: 0.1.4
    • Component/s: None
    • None

      memcheck php -r '
      $manager =  new MongoDB\Driver\Manager("mongodb:///tmp/mongodb-27018.sock,localhost:27017");
      $manager->executeQuery("foo.bar", new MongoDB\Driver\Query([]));
      '
      
      ==10566== Memcheck, a memory error detector
      ==10566== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
      ==10566== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
      ==10566== Command: php -r $manager\ =\ \ new\ MongoDB\\Driver\\Manager("mongodb:///tmp/mongodb-27018.sock,localhost:27017");\ $manager-\>executeQuery("foo.bar",\ new\ MongoDB\\Driver\\Query([]));
      ==10566== 
      
      Fatal error: Uncaught exception 'MongoDB\Driver\RuntimeException' with message 'No acceptable peer could be found.' in Command line code:1
      Stack trace:
      #0 Command line code(1): MongoDB\Driver\Manager->executeQuery('foo.bar', Object(MongoDB\Driver\Query))
      #1 {main}
        thrown in Command line code on line 1
      ==10566== 
      ==10566== HEAP SUMMARY:
      ==10566==     in use at exit: 82,393 bytes in 2,597 blocks
      ==10566==   total heap usage: 25,956 allocs, 23,359 frees, 3,071,631 bytes allocated
      ==10566== 
      ==10566== 19 bytes in 1 blocks are definitely lost in loss record 1 of 95
      ==10566==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10566==    by 0x8C257B: _emalloc (zend_alloc.c:2427)
      ==10566==    by 0x8C2B0D: _estrdup (zend_alloc.c:2631)
      ==10566==    by 0x8630E4: php_socket_strerror (network.c:992)
      ==10566==    by 0x861C6F: php_network_connect_socket (network.c:385)
      ==10566==    by 0x862EBB: php_network_connect_socket_to_host (network.c:881)
      ==10566==    by 0x880837: php_tcp_sockop_connect (xp_socket.c:672)
      ==10566==    by 0x880BB9: php_tcp_sockop_set_option (xp_socket.c:758)
      ==10566==    by 0x497B6B: php_openssl_sockop_set_option (xp_ssl.c:832)
      ==10566==    by 0x86C3E0: _php_stream_set_option (streams.c:1357)
      ==10566==    by 0x87E496: php_stream_xport_connect (transports.c:243)
      ==10566==    by 0x87DDEA: _php_stream_xport_create (transports.c:143)
      ==10566== 
      ==10566== 26 bytes in 1 blocks are definitely lost in loss record 10 of 95
      ==10566==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10566==    by 0x8C257B: _emalloc (zend_alloc.c:2427)
      ==10566==    by 0x8C2B0D: _estrdup (zend_alloc.c:2631)
      ==10566==    by 0x8630E4: php_socket_strerror (network.c:992)
      ==10566==    by 0x861B7C: php_network_connect_socket (network.c:329)
      ==10566==    by 0x88060F: php_tcp_sockop_connect (xp_socket.c:639)
      ==10566==    by 0x880BB9: php_tcp_sockop_set_option (xp_socket.c:758)
      ==10566==    by 0x86C3E0: _php_stream_set_option (streams.c:1357)
      ==10566==    by 0x87E496: php_stream_xport_connect (transports.c:243)
      ==10566==    by 0x87DDEA: _php_stream_xport_create (transports.c:143)
      ==10566==    by 0x7797A23: phongo_stream_initiator (php_phongo.c:869)
      ==10566==    by 0x775F36C: _mongoc_client_create_stream (mongoc-client.c:388)
      ==10566== 
      ==10566== 32 bytes in 1 blocks are definitely lost in loss record 22 of 95
      ==10566==    at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==10566==    by 0x8C257B: _emalloc (zend_alloc.c:2427)
      ==10566==    by 0x934EEB: zend_throw_exception (zend_exceptions.c:794)
      ==10566==    by 0x77938F9: phongo_throw_exception_from_bson_error_t (php_phongo.c:167)
      ==10566==    by 0x779657E: phongo_execute_query (php_phongo.c:611)
      ==10566==    by 0x772C5ED: zim_Manager_executeQuery (Manager.c:169)
      ==10566==    by 0x95341F: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:550)
      ==10566==    by 0x953EBA: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:685)
      ==10566==    by 0x95274A: execute_ex (zend_vm_execute.h:363)
      ==10566==    by 0x952833: zend_execute (zend_vm_execute.h:388)
      ==10566==    by 0x8F3F06: zend_eval_stringl (zend_execute_API.c:1185)
      ==10566==    by 0x8F42F8: zend_eval_stringl_ex (zend_execute_API.c:1232)
      ==10566== 
      ==10566== LEAK SUMMARY:
      ==10566==    definitely lost: 77 bytes in 3 blocks
      ==10566==    indirectly lost: 0 bytes in 0 blocks
      ==10566==      possibly lost: 0 bytes in 0 blocks
      ==10566==    still reachable: 0 bytes in 0 blocks
      ==10566==         suppressed: 82,316 bytes in 2,594 blocks
      ==10566== 
      ==10566== For counts of detected and suppressed errors, rerun with: -v
      ==10566== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
      

      memcheck php -r 5.90s user 0.09s system 99% cpu 6.025 total

            Assignee:
            bjori Hannes Magnusson
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: