Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getData() on a BLOB fails in 6.0.0 and above when attempting to get data from an AQ message payload #1571

Closed
nicholas-ochoa opened this issue Jun 7, 2023 · 12 comments

Comments

@nicholas-ochoa
Copy link

When attempting to retrieve data from a BLOB on a queue message payload, an exception is encountered in the node-oracledb driver that prevents the data from loading. This worked on 5.5.0 without any issues. I'm using the thick client in this case, because the 6.x.x thin client does not yet support Oracle Advanced Queues.

  name: 'TypeError',
  message: "Cannot read properties of undefined (reading '_parentObj')",
  stack: "TypeError: Cannot read properties of undefined (reading '_parentObj')\n" +
    '    at LobImpl._getConnImpl (C:\\git\\blob-issue\\6.0.1\\node_modules\\oracledb\\lib\\impl\\lob.js:43:29)\n' +
    '    at Lob.<anonymous> (C:\\git\\blob-issue\\6.0.1\\node_modules\\oracledb\\lib\\util.js:154:29)\n' +
    '    at Lob.<anonymous> (C:\\git\\blob-issue\\6.0.1\\node_modules\\oracledb\\lib\\util.js:176:25)\n' +
    '    at Lob.wrapper (C:\\git\\blob-issue\\6.0.1\\node_modules\\oracledb\\lib\\util.js:123:19)\n' +
    '    at main (C:\\git\\blob-issue\\6.0.1\\index.js:42:31)'

Version details:

process.platform: win32
process.version: v18.16.0
process.arch: x64
versionString: 5.5.0 and 6.0.1
oracleClientVersionString: 19.11.0.0.0

I've created a repo containing a reproduction of the issue, along with SQL scripts to recreate the database schema, objects and procedures: https://github.com/nicholas-ochoa/node-oracledb-blob-issue

@cjbj
Copy link
Member

cjbj commented Jun 7, 2023

Thanks for the report. We'll look into it.

@pvenkatraman
Copy link
Member

Both examples show deqOne() call, is there another script calling enqOne()? Thanks

@cjbj
Copy link
Member

cjbj commented Jun 8, 2023

@pvenkatraman the enqueue is done in SQL, if I read the files correctly

@pvenkatraman
Copy link
Member

@cjbj, yes noticed enqueue () in db/create-proc.sql, but there is also a dequeue() in the same file, so whatever queued, will be processed there itself.

@nicholas-ochoa
Copy link
Author

I apologize for the confusion - I created this from a portion of a much larger / complex application.

The workflow in the actual application looks like this:

  1. Server starts and listens on queue ATTACHMENT with correlation UPLOAD
  2. Client sends a message to queue ATTACHMENT with correlation UPLOAD containing a payload, which also includes the client SESSIONID, in this example let's say that is 87654321.
  3. Server receives the message and processes it. (this is where the failure is happening, in my application and in this example)
  4. Server sends a message to the queue ATTACHMENT with correlation 87654321 (the client SESSIONID).
  5. Client receives the message and handles accordingly (success / failure, timeout, etc).

I have updated my example repo to remove step 5, which is the dequeue() call you were seeing in the create-proc.sql script. In this example it would not be needed and was never getting used; I had already removed the enqOne() call (step 4) from the JavaScript portion of the example.

@cjbj
Copy link
Member

cjbj commented Jun 8, 2023

@pvenkatraman I read it wrong !

@nicholas-ochoa
Copy link
Author

Were you able to reproduce the issue with the repo / notes I provided? If not, I can try and further clarify - or try and further simplify the example repo. Unfortunately, this issue is blocking us from updating to the newer releases of the driver.

@anthony-tuininga
Copy link
Member

Yes, we can reproduce it. It isn't specific to AQ at all, either! We'll get back to you on a solution once we have it!

@sharadraju
Copy link
Member

sharadraju commented Jun 20, 2023

@nicholas-ochoa This has been fixed. And here is the patch:

index 5cc9091c..93d41809 100644
--- a/lib/connection.js
+++ b/lib/connection.js
@@ -146,6 +146,7 @@ class Connection extends EventEmitter {
       cls = this._buildDbObjectClass(objType);
       cls._connection = this;
       cls._objType = objType;
+      objType._connection = this._impl;
       this._dbObjectClasses.set(objType, cls);
     }
     return (cls);

@sharadraju
Copy link
Member

The fix will be available as part of the 6.0.2 release

@nicholas-ochoa
Copy link
Author

I tested the patch in my example reproduction and it fixes the issue. Thank you!

@sharadraju
Copy link
Member

This is now available as part of node-oracledb 6.0.2. See the release announcement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants