PHP Driver
  1. PHP Driver
  2. PHP-963

Requesting Info on Dead MongoCursor Causes Segfault

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major - P3 Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.5
    • Fix Version/s: 1.4.6
    • Component/s: Connection
    • Labels:
    • Environment:
      Ubuntu 12.04 LTS
      Mongo 2.4.8
      PHP 5.3.10-1ubuntu3.9
      Mongo Driver 1.4.5
    • Operating System:
      Linux
    • # Replies:
      5
    • Last comment by Customer:
      true

      Description

      Calling the info method on a dead MongoCursor object causes a page fault. See the script below to reproduce.

      <?php
      #################################
      # ECHO VERSIONS #################
      #################################
      echo "PHP: " . phpversion() . "\n";
      echo "Mongo Driver: " . phpversion('mongo') . "\n";
      
      ##########################################
      # CREATE FAILURE CONDITION ###############
      ##########################################
      
      $connection = new MongoClient('mongodb://localhost:27017');
      
      $connection->test->segfault_demo->insert(array('test' => 1));
      $connection->test->segfault_demo->insert(array('test' => 2));
      $connection->test->segfault_demo->insert(array('test' => 3));
      $connection->test->segfault_demo->insert(array('test' => 4));
      $connection->test->segfault_demo->insert(array('test' => 5));
      $connection->test->segfault_demo->insert(array('test' => 6));
      $connection->test->segfault_demo->insert(array('test' => 7));
      
      $txlogs = $connection->test->segfault_demo->find()->limit(5);
      
      foreach($txlogs as $txlog)  {
        echo ($txlogs->dead() ? "Dead" : "Not Dead") . "\n";
      }
      
      ################################
      # CAUSE SEGFAULT ###############
      ################################
      $txlogs->info();
      

      Output:

      PHP: 5.3.10-1ubuntu3.9
      Mongo Driver: 1.4.5
      Not Dead
      Not Dead
      Not Dead
      Not Dead
      Not Dead
      Segmentation fault
      

        Activity

        Hide
        Ben Zittlau
        added a comment -

        This might be the same issue as PHP-959.

        Show
        Ben Zittlau
        added a comment - This might be the same issue as PHP-959 .
        Hide
        Ben Zittlau
        added a comment -

        Initial description was wrong, should read 'seg fault', not 'page fault'.

        Show
        Ben Zittlau
        added a comment - Initial description was wrong, should read 'seg fault', not 'page fault'.
        Show
        Derick Rethans
        added a comment - https://github.com/mongodb/mongo-php-driver/pull/575
        Hide
        Githook User
        added a comment -

        Author:

        {u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'}

        Message: Fixed PHP-963: Requesting Info on Dead MongoCursor Causes Segfault.
        Branch: v1.4
        https://github.com/mongodb/mongo-php-driver/commit/aa53410f0da8b49ea478d168228f7dce73e15704

        Show
        Githook User
        added a comment - Author: {u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'} Message: Fixed PHP-963 : Requesting Info on Dead MongoCursor Causes Segfault. Branch: v1.4 https://github.com/mongodb/mongo-php-driver/commit/aa53410f0da8b49ea478d168228f7dce73e15704
        Hide
        Githook User
        added a comment -

        Author:

        {u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'}

        Message: Fixed PHP-963: Requesting Info on Dead MongoCursor Causes Segfault.
        Branch: master
        https://github.com/mongodb/mongo-php-driver/commit/aa53410f0da8b49ea478d168228f7dce73e15704

        Show
        Githook User
        added a comment - Author: {u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'} Message: Fixed PHP-963 : Requesting Info on Dead MongoCursor Causes Segfault. Branch: master https://github.com/mongodb/mongo-php-driver/commit/aa53410f0da8b49ea478d168228f7dce73e15704

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since reply:
              11 weeks, 1 day ago
              Date of 1st Reply: