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

PHP segfaults when adding a file to GridFS after upgrade to 1.2.9

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.2.9
    • Fix Version/s: 1.2.10
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
      php-fpm using apc and suhosin extensions
    • # Replies:
      17
    • Last comment by Customer:
      true

      Description

      After upgrade to 1.2.9 we can no longer save files to GridFS. Rolling back solves the problem. And the funny thing is - rebuilding PHP with --enable-debug also solves the problem.

      Here is a test script that always segfaults for our current production setup:

      <?php
      $bytes = file_get_contents('some-file.zip');
      $m = new Mongo('192.168.0.100'); // i.e. a remote host
      $db = $m->test;
      $grid = $db->getGridFS();
      $saved = $grid->storeBytes(
      $bytes,
      array(
      'filename' => 'test_file-'.rand(0,10000),
      'size' => 'm',
      'otherdata' => 'BIG'
      ),
      array('safe' => true)
      );

      ?>

      gdb backtrace, but I'm pretty sure that we didn't have debug enabled when I ran this.

      Program received signal SIGSEGV, Segmentation fault.
      zend_objects_store_del_ref_by_handle_ex (handle=1097737216, handlers=0x7ffff0b30360)
      at /home/kalnado/php-5.3.9/Zend/zend_objects_API.c:196
      196 if (EG(objects_store).object_buckets[handle].valid) {
      (gdb) bt
      #0 zend_objects_store_del_ref_by_handle_ex (handle=1097737216, handlers=0x7ffff0b30360)
      at /home/kalnado/php-5.3.9/Zend/zend_objects_API.c:196
      #1 0x0000000000696313 in zend_objects_store_del_ref (zobject=0x1059520) at /home/kalnado/php-5.3.9/Zend/zend_objects_API.c:172
      #2 0x0000000000668135 in _zval_dtor (zval_ptr=<value optimized out>) at /home/kalnado/php-5.3.9/Zend/zend_variables.h:35
      #3 _zval_ptr_dtor (zval_ptr=<value optimized out>) at /home/kalnado/php-5.3.9/Zend/zend_execute_API.c:447
      #4 0x000000000068026b in zend_hash_destroy (ht=0x10593e8) at /home/kalnado/php-5.3.9/Zend/zend_hash.c:529
      #5 0x0000000000673596 in _zval_dtor_func (zvalue=0x10593b8) at /home/kalnado/php-5.3.9/Zend/zend_variables.c:43
      #6 0x0000000000668135 in _zval_dtor (zval_ptr=<value optimized out>) at /home/kalnado/php-5.3.9/Zend/zend_variables.h:35
      #7 _zval_ptr_dtor (zval_ptr=<value optimized out>) at /home/kalnado/php-5.3.9/Zend/zend_execute_API.c:447
      #8 0x00007ffff0921e30 in zim_MongoGridFS_storeBytes (ht=<value optimized out>, return_value=<value optimized out>,
      return_value_ptr=<value optimized out>, this_ptr=<value optimized out>, return_value_used=<value optimized out>)
      at /tmp/pear/temp/mongo/gridfs.c:482
      #9 0x00007ffff04abc34 in suhosin_execute_internal (execute_data_ptr=0x7ffff7ed3050, return_value_used=1)
      at /home/kalnado/suhosin-0.9.32.1/execute.c:1673
      #10 0x00000000006c0684 in zend_do_fcall_common_helper_SPEC (execute_data=0x7ffff7ed3050)
      at /home/kalnado/php-5.3.9/Zend/zend_vm_execute.h:322
      #11 0x0000000000698cf8 in execute (op_array=0x1038a10) at /home/kalnado/php-5.3.9/Zend/zend_vm_execute.h:107
      #12 0x00007ffff04ac1e0 in suhosin_execute_ex (op_array=0x1038a10, zo=0, dummy=0) at /home/kalnado/suhosin-0.9.32.1/execute.c:585
      #13 0x000000000067385a in zend_execute_scripts (type=8, retval=<value optimized out>, file_count=3)
      at /home/kalnado/php-5.3.9/Zend/zend.c:1236
      #14 0x0000000000621f8d in php_execute_script (primary_file=<value optimized out>) at /home/kalnado/php-5.3.9/main/main.c:2308
      #15 0x00000000006fabf5 in main (argc=<value optimized out>, argv=<value optimized out>)
      at /home/kalnado/php-5.3.9/sapi/cli/php_cli.c:1184

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              derick Derick Rethans
              Reporter:
              edmnc Edmunds Kalnins
              Participants:
              Last commenter:
              Alexander Golin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                8 years, 11 weeks, 5 days ago
                Date of 1st Reply: