Skip to content

TimeoutNegativeWarning emitted when running on Node 24.0.1 #1751

@wilsonjackson

Description

@wilsonjackson

Describe the bug
When running on Node 24.0.1, a TimeoutNegativeWarning is emitted when the client makes a connection. The timeout value appears to be a negative timestamp, presumably resulting from this subtraction.

To Reproduce

With a trivial app:

const { Kafka } = require('kafkajs');

const kafka = new Kafka({
  brokers: ['localhost:8092']
});

const producer = kafka.producer();
producer.connect();

Run with warnings enabled:

KAFKAJS_NO_PARTITIONER_WARNING=1 node --trace-warnings index.js

Creating a producer, consumer, or admin client all cause the same emitted warning.

Expected behavior
No warnings or errors emitted.

Observed behavior

(node:25173) TimeoutNegativeWarning: -1747359280440 is a negative number.
Timeout duration was set to 1.
    at new Timeout (node:internal/timers:195:17)
    at setTimeout (node:timers:120:19)
    at RequestQueue.scheduleCheckPendingRequests (/tmp/kafkajs-warning/node_modules/kafkajs/src/network/requestQueue/index.js:317:37)
    at RequestQueue.checkPendingRequests (/tmp/kafkajs-warning/node_modules/kafkajs/src/network/requestQueue/index.js:297:10)
    at RequestQueue.fulfillRequest (/tmp/kafkajs-warning/node_modules/kafkajs/src/network/requestQueue/index.js:206:10)
    at Connection.processData (/tmp/kafkajs-warning/node_modules/kafkajs/src/network/connection.js:529:25)
    at Socket.onData (/tmp/kafkajs-warning/node_modules/kafkajs/src/network/connection.js:184:14)
    at Socket.emit (node:events:507:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)

Environment:

  • OS: MacOS 13.7.2
  • KafkaJS version: 2.2.4
  • Kafka version: 3.7.2
  • NodeJS version: 24.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions