Skip to content

Connection.prototype.isIdle: Cannot read properties of undefined (reading 'empty') #316

Description

@oklemenz2

We face a lot of occurrences of the following exception in hdb module:

TypeError: Cannot read properties of undefined (reading 'empty')
    at Connection.isIdle (/home/vcap/app/node_modules/hdb/lib/protocol/Connection.js:770:22)
    at Connection.disconnect (/home/vcap/app/node_modules/hdb/lib/protocol/Connection.js:644:12)
    at Client.disconnect (/home/vcap/app/node_modules/hdb/lib/Client.js:218:20)
    at /home/vcap/app/node_modules/@cap-js/hana/lib/drivers/base.js:168:16
    at new Promise (<anonymous>)
    at /home/vcap/app/node_modules/@cap-js/hana/lib/drivers/base.js:167:12
    at /home/vcap/app/node_modules/@cap-js/telemetry/lib/tracing/trace.js:375:16
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_context_frame:63:14)
    at AsyncLocalStorageContextManager.with (/home/vcap/app/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
    at ContextAPI.with (/home/vcap/app/node_modules/@opentelemetry/api/build/src/api/context.js:51:46)
    at Tracer.startActiveSpan (/home/vcap/app/node_modules/@opentelemetry/sdk-trace-base/build/src/Tracer.js:121:32)
    at trace (/home/vcap/app/node_modules/@cap-js/telemetry/lib/tracing/trace.js:319:17)
    at prom (/home/vcap/app/node_modules/@cap-js/telemetry/lib/tracing/cds.js:114:24)
    at HDBDriver.disconnect (/home/vcap/app/node_modules/@cap-js/hana/lib/drivers/base.js:143:61)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async #destroy (/home/vcap/app/node_modules/@cap-js/db-service/lib/common/generic-pool.js:261:9)
Image

Version currently used in production: 2.27.1: https://github.com/SAP/node-hdb/tree/v2.27.1
Version used in dev: 2.29.4: https://github.com/SAP/node-hdb/tree/v2.29.4

As the code still is in master like this:

Connection.prototype.isIdle = function isIdle() {
  return this._queue.empty && !this._queue.busy;
};

We assume this is not fixed also with newest version.

Access to undefined shall not happen. Can you check, and correct the code accordingly, so that this is prevented.

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions