Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-963

Requesting Info on Dead MongoCursor Causes Segfault

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.5
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Labels:
    • Environment:
      Ubuntu 12.04 LTS
      Mongo 2.4.8
      PHP 5.3.10-1ubuntu3.9
      Mongo Driver 1.4.5
    • # 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

        Attachments

          Activity

            People

            Assignee:
            derick Derick Rethans
            Reporter:
            benzittlau Ben Zittlau
            Participants:
            Last commenter:
            Alexander Golin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              6 years, 51 weeks, 6 days ago
              Date of 1st Reply: