Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-56

TypeError: Cannot read property 'totalConnections' of undefined

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2-RC
    • Fix Version/s: 2.0.3-GA
    • Component/s: pool
    • Labels:
    • Environment:
      Linux Ubuntu 18.04
      node v8.15.0
      yarn v1.13.0
      Server version: 10.3.11-MariaDB-1:10.3.11+maria~xenial-log mariadb.org binary distribution

      Description

      Hi,

      We are developing an application and using mariadb connection pools to access our database. The project is on my laptop but the database server is on a different machine which is in the same LAN with my laptop.

      I left the node process running for an hour or so and when I returned and tried to use the application (without restarting it) I saw some connection errors:

      (node:10751) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'totalConnections' of undefined
      at checkPoolSize (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:502:39)
      at conn.connect.then.catch.err (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:378:23)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:189:7)
      (node:10751) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
      not handled with .catch(). (rejection id: 3)
      (node:10751) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
      (node:10751) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'totalConnections' of undefined
      at checkPoolSize (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:502:39)
      at conn.connect.then.catch.err (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:378:23)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:189:7)
      (node:10751) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
      not handled with .catch(). (rejection id: 5)
      /home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:502
      if (!connectionInCreation && this.totalConnections() < opts.connectionLimit && !closed) {
      ^

      TypeError: Cannot read property 'totalConnections' of undefined
      at checkPoolSize (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:502:39)
      at Connection.conn.on.err (/home/mehmet/development/user-manager/node_modules/mariadb/lib/pool.js:490:21)
      at emitOne (events.js:116:13)
      at Connection.emit (events.js:211:7)
      at /home/mehmet/development/user-manager/node_modules/mariadb/lib/connection.js:1128:16
      at Connection._socketErrorHandler (/home/mehmet/development/user-manager/node_modules/mariadb/lib/connection.js:1093:9)
      at emitOne (events.js:116:13)
      at Socket.emit (events.js:211:7)
      at emitErrorNT (internal/streams/destroy.js:66:8)
      at _combinedTickCallback (internal/process/next_tick.js:139:11)

      It seems somehow the internal pool variables are nullified, like garbage collected. Have you ever seen something like this before?

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            mehmetb Mehmet Baker
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: