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

If a connection times out on the client side it is left open in state CLOSE_WAIT on server side


    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: 1.5.5
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Labels:
    • Environment:
      Clients: Ubuntu 14.04 / Mac OSX, PHP-FPM 5.4 / 5.5
      Server: Ubuntu 14.04, Mongo 2.6.4
    • # Replies:
    • Last comment by Customer:


      We upgraded servers from 2.4.x to 2.6.4 and this issue came up.

      We have MongoCursor::$timeout=20000 in our scripts. Unfortunately some queries do sometimes take that long and are then killed. This worked fine until upgrade. After upgrade the server does not close these connections and they are left in state CLOSE_WAIT. The server gradually becomes unresponsive and has to be restarted. Also if the client stops sending requests, the connections are closed (noticed this when trying to reproduce the situation in testing). Here is a simple script I used to reproduce this error:

      MongoCursor::$timeout = 100;
      $mc = new MongoClient("mongodb://test-server");
      $coll = $db->test->collection;
      $reg = new MongoRegex("/^Text/i");
      $it = $coll->find(array("textfield"=> $reg));

      I then used siege (or ab) to stress this script with 10 concurrent connections. mongostat showed open connections on the server side going up from 18 to 1140 Performing other queries while this was going on (without the timeout) was also impossible.

      We also tried setting $timeout to -1 in production, but we then hit PHPs max_execution_time which eventually caused the same affect.




            • Votes:
              1 Vote for this issue
              6 Start watching this issue


              • Created:
                Days since reply:
                1 year, 40 weeks, 6 days ago
                Date of 1st Reply: