title: Mongodb with very high CPU rate
body: <p>When I ran the following code and killed it immediately(that means to abnormally exit), the CPU rate of Mongodb would go extremely high(around 100%):</p>
  
  <pre><code>#-*- encoding:UTF-8 -*-
  
  import threading
  import time
  
  import pymongo
  
  single_conn = pymongo.Connection('localhost', 27017)
  
  class SimpleExampleThread(threading.Thread):
      def run(self):
          print single_conn['scrapy'].zhaodll.count(), self.getName()
          time.sleep(20)
  
  for i in range(100):
      SimpleExampleThread().start()
  </code></pre>
  
  <p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\  </p>
  
  <pre><code>VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  696m  35m 6404 S 1181.7  0.1 391:45.31 mongod
  </code></pre>
  
  <p>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\</p>
  
  <p>My Mongodb version is 2.2.3. When the Mongodb worked well, ran the command "strace -c -p " for 1 minute giving the following output:</p>
  
  <pre><code>% time     seconds  usecs/call     calls    errors syscall
  ------ ----------- ----------- --------- --------- ----------------
   33.50    0.322951         173      1867           nanosleep
   33.19    0.319950         730       438           recvfrom
   21.16    0.203969          16     12440           select
   12.13    0.116983       19497         6           restart_syscall
    0.02    0.000170           2        73           write
    0.00    0.000016           0       146           sendto
    0.00    0.000007           0        73           lseek
    0.00    0.000000           0         2           read
    0.00    0.000000           0         3           open
    0.00    0.000000           0         3           close
    0.00    0.000000           0         2           fstat
    0.00    0.000000           0        87           mmap
    0.00    0.000000           0         2           munmap
    0.00    0.000000           0         1           pwrite
    0.00    0.000000           0         3           msync
    0.00    0.000000           0        29           mincore
    0.00    0.000000           0        73           fdatasync
  ------ ----------- ----------- --------- --------- ----------------
  100.00    0.964046                 15248           total
  </code></pre>
  
  <p>When the cpu rate of Mongodb went very high(around 100%), ran the same command giving the following output:</p>
  
  <pre><code>% time     seconds  usecs/call     calls    errors syscall
  ------ ----------- ----------- --------- --------- ----------------
   29.12    5.064230        3088      1640           nanosleep
   28.83    5.013239       27851       180           recvfrom
   22.72    3.950399      658400         6           restart_syscall
   19.30    3.356491         327     10268           select
    0.02    0.004026          67        60           sendto
    0.01    0.001000         333         3           msync
    0.00    0.000269           9        30           write
    0.00    0.000125           4        30           fdatasync
    0.00    0.000031          10         3           open
    0.00    0.000000           0         2           read
    0.00    0.000000           0         3           close
    0.00    0.000000           0         2           fstat
    0.00    0.000000           0        30           lseek
    0.00    0.000000           0        57           mmap
    0.00    0.000000           0         2           munmap
    0.00    0.000000           0         1           pwrite
    0.00    0.000000           0        14           mincore
  ------ ----------- ----------- --------- --------- ----------------
  100.00   17.389810                 12331           total
  </code></pre>
  
  <p>And if I run the command "lsof", there are many socks with the description "can't identify protocol". I don't know what goes wrong. Are there some bugs in Mongodb?</p>
  
  <p>Thanks!</p>