Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-688

Error Object #<CleartextStream> has no method 'unref'

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.16
    • Affects Version/s: 1.4
    • Component/s: MongoDB 3.2
    • Environment:
      Heroku

      My Environment

      node: 0.10.26
      mongodb-core: 1.3.13
      MongoDB database: v3.2.1

      NOTE: Jira wouldn't let me choose 1.3.13 for the affected version so I chose 1.4. The actual mongodb-core version is 1.3.13.

      I'm using mongojs, but this appears to be a mongodb-core issue. My connection info looks like this:

          //connection string
          mongodb://username:password@aws-us-east-1-portal.4.dblayer.com:00000,aws-us-east-1-portal.3.dblayer.com:00000/dbname?ssl=true
          
          //options
          { "mongos": {
            "ssl": true,
            "sslValidate": false
          } }
      

      The Error

      From time to time I get this error:

          Object #<CleartextStream> has no method 'unref' 
          TypeError: Object #<CleartextStream> has no method 'unref' 
              at Connection.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:441:21) 
              at /app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:189:7 
              at Array.forEach (native) 
              at Pool.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:182:15) 
              at Server.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:1040:31) 
              at Server.close (/app/node_modules/mongojs/node_modules/mongodb/lib/server.js:398:17) 
              at Db.close (/app/node_modules/mongojs/node_modules/mongodb/lib/db.js:357:19) 
              at /app/node_modules/mongojs/node_modules/mongodb/lib/mongo_client.js:312:14 
              at /app/node_modules/mongojs/node_modules/mongodb/lib/db.js:234:5 
              at connectHandler (/app/node_modules/mongojs/node_modules/mongodb/lib/server.js:306:7) 
              at g (events.js:180:16) 
              at EventEmitter.emit (events.js:95:17) 
              at /app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:540:23 
              at commandCallback (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:1161:9) 
              at Callbacks.emit (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:119:3) 
              at null.messageHandler (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:295:23) 
      

      Line 441 is actually commented out, but there is a nearby call to `connection.unref()` so I'm guessing that's the issue.

      It looks like `tls.TLSSocket` replaced `CleartextStream` in node v0.10.40.

      I'm guessing `connection.unref()` expects node 0.10.40 or higher.

      So mongodb-core only supports node 0.10.40 or higher - does that sound right?

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            bendytree Josh Wright
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: