Skip to content

Internal error with multiple CQN subscriptions using the same name #1718

@jogold

Description

@jogold
  1. What versions are you using?

oracle: 19.0.0.0.ru-2023-10.rur-2023-10.r1
platform: linux
version: 22.12.0
arch: x64
require('oracledb').versionString: 6.7.1
require('oracledb').oracleClientVersionString: 21.16.0.0

  1. Describe the problem

Getting the error: internal error in file ../src/njsConnection.c, line 2490 (no error message) when trying to create multiple CQN subscriptions using the same name.

If I call connection.subscribe() only once I have no issues.

The same code runs fine in v5.5.0

  1. Include a runnable Node.js script that shows the problem.
const oracledb = require('oracledb');
oracledb.initOracleClient();

const interval = setInterval(() => null, 5000);

async function cqnCallback(message) {
  console.log(message);
}

const subscriptions = [
  'SQL1',
  'SQL2',
];

async function main() {
  let connection: oracledb.Connection | undefined;
  try {
    connection = await oracledb.getConnection(connectionAttributes);
    for (const subscription of subscriptions) {
      await connection.subscribe('cqn', {
        callback: cqnCallback,
        port: 5000,
        timeout: 24 * 60 * 60, // 24 hours
        qos: oracledb.SUBSCR_QOS_QUERY | oracledb.SUBSCR_QOS_ROWIDS,
        sql: subscription,
        operations: oracledb.CQN_OPCODE_INSERT | oracledb.CQN_OPCODE_UPDATE,
      });
    }
  } catch (err) {
    console.log(err);
    clearInterval(interval);
  } finally {
    if (connection) {
      try {
        await connection.close();
      } catch (err) {
        console.log(err);
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions