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

Memory overflow running the driver with Swoole and jemalloc

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • 1.1.5
    • Affects Version/s: 1.1.2
    • Component/s: None
    • None

      From mongodb/mongo-php-driver#213:

      i use swoole (https://github.com/swoole/swoole-src) , mongodb together, test code like

      <?php
      
      $server = new swoole_server('127.0.0.1', 9501);
      $server->set(array(
          'worker_num' => 1,
          'task_worker_num' => 2,
          'log_file'   => './swoole.log'
      ));
      
      $server->on('workerStart', function($serv, $worker_id){
          echo 'worker start :' . $worker_id . ',pid :' . getmypid() . PHP_EOL;
      });
      
      $server->on('task', function($serv, $task_id, int $from_id, string $data){
          echo 'on task  :' . $task_id . ',pid :' . getmypid() . PHP_EOL;
      });
      
      $server->on('finish', function($serv, $task_id, string $data){
          echo 'on finish  :' . $task_id . ',pid :' . getmypid() . PHP_EOL;
      });
      
      $server->on('receive', function ($serv, $fd, $from_id, $data) {
          $serv->reload(true);
      });
      
      $server->start();
      

      where server receive any data, i will set server to reload, but occurs

      [Mon Feb  1 17:12:39 2016]  Script:  '/Users/xingqiba/Desktop/haha.php'
      ---------------------------------------
      /Users/xingqiba/data/softs/mongodb-1.1.2/php_phongo.c(2248) : Block 0x7fe95255a040 status:
      Beginning:  	Freed (magic=0x00000000, expected=0x99954317)
          Start:	Overflown (magic=0x00000035 instead of 0x4060D864)
                	At least 4 bytes overflown
      worker start :1,pid :71250
      [Mon Feb  1 17:12:39 2016]  Script:  '/Users/xingqiba/Desktop/haha.php'
      ---------------------------------------
      /Users/xingqiba/data/softs/mongodb-1.1.2/php_phongo.c(2248) : Block 0x7fe95255a040 status:
      Beginning:  	Freed (magic=0x00000000, expected=0x99954317)
          Start:	Overflown (magic=0x00000035 instead of 0x4060D864)
                	At least 4 bytes overflown
      

      if i don't use mongodb in php.ini, it's ok!

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            bjori Hannes Magnusson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: