Assert failure: no null #5

Closed
opened 2012-07-12 20:17:02 +01:00 by Wred · 7 comments
Wred commented 2012-07-12 20:17:02 +01:00 (Migrated from github.com)

Some of my execute calls fail at the "no null" assertion at line 128 in index.js. I tried changing the code to take the entire buffer if there is no null but then I get a different bug where it can't find the callback - I'll see what's going on there. Here's what I tried:

    var p = self.buffer.indexOf(CHR0);
    if (p == -1)
        p = self.buffer.length -1;

I was wondering if you had any idea what might be going on "under the hood". Seems the xquery calls work fine in the BaseX client (although there are quite a few and I'll need to test them all).

Some of my execute calls fail at the "no null" assertion at line 128 in index.js. I tried changing the code to take the entire buffer if there is no null but then I get a different bug where it can't find the callback - I'll see what's going on there. Here's what I tried: ``` var p = self.buffer.indexOf(CHR0); if (p == -1) p = self.buffer.length -1; ``` I was wondering if you had any idea what might be going on "under the hood". Seems the xquery calls work fine in the BaseX client (although there are quite a few and I'll need to test them all).
Wred commented 2012-07-12 20:51:17 +01:00 (Migrated from github.com)

OK, I just figured it out and have a fix. Will send it your way in a sec.

OK, I just figured it out and have a fix. Will send it your way in a sec.
Wred commented 2012-07-12 20:57:59 +01:00 (Migrated from github.com)

Seems the npm version is out of date...

Seems the npm version is out of date...
apb2006 commented 2012-07-12 23:13:12 +01:00 (Migrated from github.com)

I am aware of this problem. It is due to the nature of Node and async buffers. Some of code is not properly testing that the entire message it wants to parse is available. The latest code has a better, approach to the problem (parser.js) BUT it is not yet implemented everywhere. It may not fix your problem, but I am working on it.

I am aware of this problem. It is due to the nature of Node and async buffers. Some of code is not properly testing that the entire message it wants to parse is available. The latest code has a better, approach to the problem (parser.js) BUT it is not yet implemented everywhere. It may not fix your problem, but I am working on it.
Wred commented 2012-07-17 18:48:53 +01:00 (Migrated from github.com)

OK thanks Andy. When you manage to get it implemented, can you update the npm package and let us know? My fix is working fine for now but looking at what you've done here, I'd like to use your implementation eventually.

Oh an in case anyone else needs my quick fix, this should be the first two lines of the "parser1" function:

    var matches = self.buffer.match(/\x00/gi);
    if (matches && (matches.length > 1)) {
OK thanks Andy. When you manage to get it implemented, can you update the npm package and let us know? My fix is working fine for now but looking at what you've done here, I'd like to use your implementation eventually. Oh an in case anyone else needs my quick fix, this should be the first two lines of the "parser1" function: ``` var matches = self.buffer.match(/\x00/gi); if (matches && (matches.length > 1)) { ```
apb2006 commented 2012-07-19 23:22:07 +01:00 (Migrated from github.com)

I have published version 0.5.1 to npm. It should fix this issue. Please let me know if it works for you.

I have published version 0.5.1 to npm. It should fix this issue. Please let me know if it works for you.
Wred commented 2012-07-20 01:36:21 +01:00 (Migrated from github.com)

OK great. I'll give it a go tomorrow. I already tried a more recent version today and it worked great so I imagine I won't have any trouble.

OK great. I'll give it a go tomorrow. I already tried a more recent version today and it worked great so I imagine I won't have any trouble.
Wred commented 2012-07-20 16:23:27 +01:00 (Migrated from github.com)

Gave it a go today and it's working great. Thanks Andy!

Gave it a go today and it's working great. Thanks Andy!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
quodatum/basex-node#5
No description provided.