Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-579

when i query data,i have got a expetion:SocketException handling request, closing client connection: 9001 socket exception [2] server in logfile

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • linux,64bit.

    Description

      ==============================background==================================
      I start mongodb use like this(single server): -dbpath=/usr/local/mongodb-2.0.5/data/db1 -poart=2715 -maxConns=1000 -logpath=/usr/local/mongodb-2.0.5/log/logsingle.log

      the java code to operator mongodb to query data like this:

      private static Mongo mongo=null;
      static{
          MongoOptions options = new MongoOptions();
          options.autoConnectRetry = true;
          options.connectionsPerHost=1000;
          options.threadsAllowedToBlockForConnectionMultiplier=10;
          options.connectTimeout = 6000;
          options.maxAutoConnectRetryTime = 12000;
          options.maxWaitTime = 12000; 
          options.socketKeepAlive = true;
          options.socketTimeout = 2000;
          mongo = new Mongo(new ServerAddress("localhost", 2715),options);
      }
       
      public void queryData(Object key){
         DB db = mongo.getDB(DATABASE_NAME);
         DBCollection dbcollection = db.getCollection(collection);
         BasicDBObject doc = new BasicDBObject();
         doc.put("key", key);
         DBCursor cursor = dbcollection.find(doc);
      }

      ================================ERROR=======================================
      i am stress test the mongodb use http_client tool. use 10 thread to test the query. after some time,the server is died.and cpu is 100%.and then i am got the exception from logfile like this:
      Thu May 31 14:18:10 [conn154] query mydb.ben\ query:

      { key: "1" }

      nscanned:53832616 reslen:20 11032064ms
      Thu May 31 14:18:10 [conn154] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53887]
      Thu May 31 14:18:11 [conn173] query mydb.ben\ query:

      { key: "6" }

      nscanned:53832616 reslen:20 11014949ms
      Thu May 31 14:18:11 [conn173] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53906]
      Thu May 31 14:18:12 [conn160] query mydb.ben\ query:

      { key: "7" }

      nscanned:53832616 reslen:20 11028041ms
      Thu May 31 14:18:12 [conn160] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53893]
      Thu May 31 14:18:14 [conn161] query mydb.ben\ query:

      { key: "7" }

      nscanned:53832616 reslen:20 11029619ms
      Thu May 31 14:18:14 [conn161] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53894]
      Thu May 31 14:18:17 [conn149] query mydb.ben\ query:

      { key: "6" }

      nscanned:53832616 reslen:20 11045234ms
      Thu May 31 14:18:18 [conn149] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53882]
      Thu May 31 14:18:24 [conn151] query mydb.ben\ query:

      { key: "6" }

      nscanned:53832616 reslen:20 11049350ms
      Thu May 31 14:18:24 [conn151] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53884]
      Thu May 31 14:18:25 [conn157] query mydb.ben\ query:

      { key: "6" }

      nscanned:53832616 reslen:20 11044775ms
      Thu May 31 14:18:25 [conn157] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53890]
      Thu May 31 14:18:32 [conn171] query mydb.ben\ query:

      { key: "5" }

      nscanned:53832616 reslen:20 11037628ms
      Thu May 31 14:18:32 [conn171] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53904]
      Thu May 31 14:18:37 [conn155] query mydb.ben\ query:

      { key: "6" }

      nscanned:53832616 reslen:20 11059201ms
      Thu May 31 14:18:37 [conn155] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53888]
      Thu May 31 14:18:40 [conn148] query mydb.ben\ query:

      { key: "1" }

      nscanned:53832616 reslen:20 11067425ms
      Thu May 31 14:18:40 [conn148] SocketException handling request, closing client connection: 9001 socket exception [2] server [127.0.0.1:53881]

      i wonder is options.socketKeepAlive = true; trigger the error.because when use this config,the error is start to appear.but i'm not sure.

      Attachments

        Activity

          People

            Unassigned Unassigned
            shaobenbin ben.s
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: